commented all code to prevent erasing the file

This commit is contained in:
jorge 2022-07-05 07:50:50 +02:00
parent d4ee1882cd
commit 98481bffe2
1 changed files with 103 additions and 100 deletions

View File

@ -1,116 +1,119 @@
<?php <?php
// commented all code on 2022 07 05
// file can be deleted after this date on next upgrade
// create the new custom fields for this custom post type // create the new custom fields for this custom post type
add_action("admin_init", "admin_init"); // add_action("admin_init", "admin_init");
function admin_init(){ // function admin_init(){
add_meta_box("dades_artistes", "Dades artista i obra", "dades_obres_autor", "page", "normal", "high"); // add_meta_box("dades_artistes", "Dades artista i obra", "dades_obres_autor", "page", "normal", "high");
add_meta_box("dades_activitats", "Dades activitats", "dades_cal_activitats", "post", "side", "low"); // add_meta_box("dades_activitats", "Dades activitats", "dades_cal_activitats", "post", "side", "low");
add_meta_box("incloure_home","Incloure a la home","incloure_at_home","page","side","high"); // add_meta_box("incloure_home","Incloure a la home","incloure_at_home","page","side","high");
add_meta_box("incloure_home","Incloure a la home","incloure_at_home","post","side","high"); // add_meta_box("incloure_home","Incloure a la home","incloure_at_home","post","side","high");
add_meta_box("equip","Dades personals","afegir_dades_personals","page","normal","high"); // add_meta_box("equip","Dades personals","afegir_dades_personals","page","normal","high");
} // }
add_action( 'init', 'anys_artistes', 0 ); // add_action( 'init', 'anys_artistes', 0 );
function anys_artistes() { // function anys_artistes() {
register_taxonomy('anys', array('page'), array('public' => true, 'label' => 'Anys', 'singular_label' => 'Any', 'rewrite' => true)); // register_taxonomy('anys', array('page'), array('public' => true, 'label' => 'Anys', 'singular_label' => 'Any', 'rewrite' => true));
} // }
function dades_obres_autor() { // function dades_obres_autor() {
global $post; // global $post;
$custom = get_post_custom($post->ID); // $custom = get_post_custom($post->ID);
$autor_obra = $custom['autor_obra'][0]; // $autor_obra = $custom['autor_obra'][0];
$data_obra = $custom['data_obra'][0]; // $data_obra = $custom['data_obra'][0];
$autor_data_resid = $custom['autor_data_resid'][0]; // $autor_data_resid = $custom['autor_data_resid'][0];
//here we construct the fields for the backend user interface //here we construct the fields for the backend user interface
?> ?>
<label class="dd">Cognoms, nom de l'artista:</label> <!-- <label class="dd">Cognoms, nom de l'artista:</label> -->
<input class="dd" name="autor_obra" value="<?php if(!empty($autor_obra)) echo $autor_obra; ?>"></input> <!-- <input class="dd" name="autor_obra" value="<?php //if(!empty($autor_obra)) echo $autor_obra; ?>"></input> -->
<label class="dd">Periode residència artista:</label> <!-- <label class="dd">Periode residència artista:</label> -->
<input class="dd" name="autor_data_resid" value="<?php if(!empty($autor_data_resid)) echo $autor_data_resid; ?>"></input> <!-- <input class="dd" name="autor_data_resid" value="<?php //if(!empty($autor_data_resid)) echo $autor_data_resid; ?>"></input> -->
<label class="dd">Data obra:</label> <!-- <label class="dd">Data obra:</label> -->
<input class="dd" name="data_obra" value="<?php if(!empty($data_obra)) echo $data_obra; ?>"></input> <!-- <input class="dd" name="data_obra" value="<?php //if(!empty($data_obra)) echo $data_obra; ?>"></input> -->
<br/> <!-- <br/> -->
<?php <?php
} // }
function dades_cal_activitats() { // function dades_cal_activitats() {
global $post; // global $post;
$custom = get_post_custom($post->ID); // $custom = get_post_custom($post->ID);
$data_activitat = $custom['data_activitat'][0]; // $data_activitat = $custom['data_activitat'][0];
$lloc_activitat = $custom['lloc_activitat'][0]; // $lloc_activitat = $custom['lloc_activitat'][0];
$horari_activitat = $custom['horari_activitat'][0]; // $horari_activitat = $custom['horari_activitat'][0];
//here we construct the fields for the backend user interface //here we construct the fields for the backend user interface
?> ?>
<label class="lateral">Lloc activitat:</label> <!-- <label class="lateral">Lloc activitat:</label> -->
<input class="lateral" name="lloc_activitat" value="<?php if(!empty($lloc_activitat)) echo $lloc_activitat; ?>"></input> <!-- <input class="lateral" name="lloc_activitat" value="<?php //if(!empty($lloc_activitat)) echo $lloc_activitat; ?>"></input> -->
<label class="lateral">Data activitat:</label> <!-- <label class="lateral">Data activitat:</label> -->
<input class="lateral" name="data_activitat" value="<?php if(!empty($data_activitat)) echo $data_activitat; ?>"></input> <!-- <input class="lateral" name="data_activitat" value="<?php //if(!empty($data_activitat)) echo $data_activitat; ?>"></input> -->
<br/> <!-- <br/> -->
<label class="lateral">Horari activitat:</label> <!-- <label class="lateral">Horari activitat:</label> -->
<input class="lateral" name="horari_activitat" value="<?php if(!empty($horari_activitat)) echo $horari_activitat; ?>"></input> <!-- <input class="lateral" name="horari_activitat" value="<?php //if(!empty($horari_activitat)) echo $horari_activitat; ?>"></input> -->
<?php <?php
} // }
function afegir_dades_personals() { // function afegir_dades_personals() {
global $post; // global $post;
$custom = get_post_custom($post->ID); // $custom = get_post_custom($post->ID);
$carrec = $custom['carrec'][0]; // $carrec = $custom['carrec'][0];
$email = $custom['email'][0]; // $email = $custom['email'][0];
$telefon = $custom['telefon'][0]; // $telefon = $custom['telefon'][0];
//here we construct the fields for the backend user interface //here we construct the fields for the backend user interface
?> ?>
<label class="lateral">Càrrec:</label> <!-- <label class="lateral">Càrrec:</label> -->
<input class="lateral" name="carrec" value="<?php if(!empty($carrec)) echo $carrec; ?>"></input> <!-- <input class="lateral" name="carrec" value="<?php //if(!empty($carrec)) echo $carrec; ?>"></input> -->
<label class="lateral">Email:</label> <!-- <label class="lateral">Email:</label> -->
<input class="lateral" name="email" value="<?php if(!empty($email)) echo $email; ?>"></input> <!-- <input class="lateral" name="email" value="<?php //if(!empty($email)) echo $email; ?>"></input> -->
<label class="lateral">Telèfon:</label> <!-- <label class="lateral">Telèfon:</label> -->
<input class="lateral" name="telefon" value="<?php if(!empty($telefon)) echo $telefon; ?>"></input> <!-- <input class="lateral" name="telefon" value="<?php //if(!empty($telefon)) echo $telefon; ?>"></input> -->
<?php <?php
} // }
function incloure_at_home() { // function incloure_at_home() {
global $post; // global $post;
$custom = get_post_custom($post->ID); // $custom = get_post_custom($post->ID);
$Inici = $custom['Inici'][0]; // $Inici = $custom['Inici'][0];
$Ordre_inici = $custom['Ordre_inici'][0]; // $Ordre_inici = $custom['Ordre_inici'][0];
//here we construct the fields for the backend user interface //here we construct the fields for the backend user interface
?> ?>
<label class="lateral petit">Inici? </label> <!-- <label class="lateral petit">Inici? </label> -->
<input class="lateral chk" type="checkbox" name="Inici" value="1" <?php checked( $Inici, 1 ) ;?> /> <!-- <input class="lateral chk" type="checkbox" name="Inici" value="1" <?php //checked( $Inici, 1 ) ;?> /> -->
<label class="lateral petit">Ordre:</label> <!-- <label class="lateral petit">Ordre:</label> -->
<input class="lateral petit" name="Ordre_inici" value="<?php if(!empty($Ordre_inici)) echo $Ordre_inici; ?>"></input> <!-- <input class="lateral petit" name="Ordre_inici" value="<?php //if(!empty($Ordre_inici)) echo $Ordre_inici; ?>"></input> -->
<?php <?php
} // }
// here we save the data in database // here we save the data in database
add_action('save_post', 'save_details'); // add_action('save_post', 'save_details');
function save_details(){ // function save_details(){
global $post; // global $post;
$post_id = $post->ID; // $post_id = $post->ID;
// verify if this is an auto save routine. If it is our form has not been submitted, so we dont want // verify if this is an auto save routine. If it is our form has not been submitted, so we dont want
// to do anything // to do anything
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) // if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )
return $post_id; // return $post_id;
if ($post->post_type == 'page') : // if ($post->post_type == 'page') :
update_post_meta($post_id, "autor_obra", $_POST['autor_obra']); // update_post_meta($post_id, "autor_obra", $_POST['autor_obra']);
update_post_meta($post_id, "data_obra", $_POST['data_obra']); // update_post_meta($post_id, "data_obra", $_POST['data_obra']);
update_post_meta($post_id, "autor_data_resid", $_POST['autor_data_resid']); // update_post_meta($post_id, "autor_data_resid", $_POST['autor_data_resid']);
update_post_meta($post_id, "Inici", $_POST['Inici']); // update_post_meta($post_id, "Inici", $_POST['Inici']);
update_post_meta($post_id, "Ordre_inici", $_POST['Ordre_inici']); // update_post_meta($post_id, "Ordre_inici", $_POST['Ordre_inici']);
update_post_meta($post_id, "carrec", $_POST['carrec']); // update_post_meta($post_id, "carrec", $_POST['carrec']);
update_post_meta($post_id, "email", $_POST['email']); // update_post_meta($post_id, "email", $_POST['email']);
update_post_meta($post_id, "telefon", $_POST['telefon']); // update_post_meta($post_id, "telefon", $_POST['telefon']);
else : // else :
update_post_meta($post_id, "Inici", $_POST['Inici']); // update_post_meta($post_id, "Inici", $_POST['Inici']);
update_post_meta($post_id, "Ordre_inici", $_POST['Ordre_inici']); // update_post_meta($post_id, "Ordre_inici", $_POST['Ordre_inici']);
update_post_meta($post_id, "data_activitat", $_POST['data_activitat']); // update_post_meta($post_id, "data_activitat", $_POST['data_activitat']);
update_post_meta($post_id, "lloc_activitat", $_POST['lloc_activitat']); // update_post_meta($post_id, "lloc_activitat", $_POST['lloc_activitat']);
update_post_meta($post_id, "horari_activitat", $_POST['horari_activitat']); // update_post_meta($post_id, "horari_activitat", $_POST['horari_activitat']);
endif; // endif;
} //end function // } //end function
?> ?>