Compare commits

...

3 Commits

3 changed files with 238 additions and 235 deletions

View File

@ -63,85 +63,85 @@ add_filter('admin_footer_text', 'remove_footer_admin');
// THIS GIVES US SOME OPTIONS FOR STYLING THE ADMIN AREA // THIS GIVES US SOME OPTIONS FOR STYLING THE ADMIN AREA
function custom_controls() { function custom_controls() {
echo '<style type="text/css"> // echo '<style type="text/css">
label.lateral{width: 100px;} // label.lateral{width: 100px;}
input.lateral{width: 150px; border-color: #ddd;} // input.lateral{width: 150px; border-color: #ddd;}
.petit {width: 20px!important;} // .petit {width: 20px!important;}
label.dd{float:left; width:250px;} // label.dd{float:left; width:250px;}
input.dd{width:450px;} // input.dd{width:450px;}
</style>'; // </style>';
} }
add_action('admin_head', 'custom_controls'); add_action('admin_head', 'custom_controls');
/* create calendar event when saving post with dates */ /* create calendar event when saving post with dates */
function create_event( $post_id ) { // function create_event( $post_id ) {
//
// If this is just a revision, don't send the email. // // If this is just a revision, don't send the email.
if ( wp_is_post_revision( $post_id ) ) // if ( wp_is_post_revision( $post_id ) )
return; // return;
//
$myPost = get_post($post_id); // $myPost = get_post($post_id);
if (has_category(array('news', 'activitats-dels-residents'), $post_id) && // if (has_category(array('news', 'activitats-dels-residents'), $post_id) &&
!$update && // !$update &&
$myPost->post_modified_gmt == $myPost->post_date_gmt) { // $myPost->post_modified_gmt == $myPost->post_date_gmt) {
//
//The URL that we want to send a PUT request to. // //The URL that we want to send a PUT request to.
$uid = get_the_guid( $post_id ); // $uid = get_the_guid( $post_id );
$url = 'https://cloud.hangar.org/remote.php/dav/calendars/hangar/hangar_activitats/neu.ics'; // $url = 'https://cloud.hangar.org/remote.php/dav/calendars/hangar/hangar_activitats/neu.ics';
$headers = array('Content-Type: text/calendar', 'charset=utf-8'); // $headers = array('Content-Type: text/calendar', 'charset=utf-8');
$userpwd = 'hangar:AV63xlklCuOJgYTnHz5smX4chiAaDpJo'; // $userpwd = 'hangar:AV63xlklCuOJgYTnHz5smX4chiAaDpJo';
$description = get_the_content( $post_id ); // $description = get_the_content( $post_id );
$summary = get_the_title( $post_id ); // $summary = get_the_title( $post_id );
$tstart = gmdate("Ymd\THis\Z", strtotime("-2 days")); // $tstart = gmdate("Ymd\THis\Z", strtotime("-2 days"));
$tend = gmdate("Ymd\THis\Z", strtotime("-2 days")); // $tend = gmdate("Ymd\THis\Z", strtotime("-2 days"));
$tstamp = gmdate("Ymd\THis\Z"); // $tstamp = gmdate("Ymd\THis\Z");
//
// vcalendar // // vcalendar
$body = 'BEGIN:VCALENDAR // $body = 'BEGIN:VCALENDAR
VERSION:2.0 // VERSION:2.0
BEGIN:VEVENT // BEGIN:VEVENT
DTSTAMP:$tstamp // DTSTAMP:$tstamp
DTSTART:$tstart // DTSTART:$tstart
DTEND:$tend // DTEND:$tend
UID:$uid // UID:$uid
DESCRIPTION:$description // DESCRIPTION:$description
LOCATION:Hangar // LOCATION:Hangar
SUMMARY:$summary // SUMMARY:$summary
END:VEVENT // END:VEVENT
END:VCALENDAR'; // END:VCALENDAR';
//
//Initiate cURL // //Initiate cURL
$ch = curl_init($url); // $ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); // curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); // curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, $userpwd); // curl_setopt($ch, CURLOPT_USERPWD, $userpwd);
//curl_setopt($ch, CURLOPT_PUT, true); // //curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_POSTFIELDS, $body); // curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
//
//Execute the request. // //Execute the request.
$response = curl_exec($ch); // $response = curl_exec($ch);
curl_close($ch); // curl_close($ch);
//
// send confirmation mail // // send confirmation mail
$post_title = $summary; // $post_title = $summary;
$post_excerpt = $description; // $post_excerpt = $description;
$post_url = get_permalink( $post_id ); // $post_url = get_permalink( $post_id );
$subject = 'A new EVENT post has been saved'; // $subject = 'A new EVENT post has been saved';
//
$message = "A new post has been created on your website:\n\n"; // $message = "A new post has been created on your website:\n\n";
$message .= $post_title . ": " . $post_url . "\n\n"; // $message .= $post_title . ": " . $post_url . "\n\n";
$message .= $post_excerpt . "\n\n"; // $message .= $post_excerpt . "\n\n";
$message .= $uid . "\n\n"; // $message .= $uid . "\n\n";
$message .= print_r($response); // $message .= print_r($response);
//
// Send email to admin. // // Send email to admin.
wp_mail( 'gerald@hangar.org', $subject, $message ); // wp_mail( 'gerald@hangar.org', $subject, $message );
} // }
} // }
add_action( 'save_post', 'create_event', 10, 3 ); // add_action( 'save_post', 'create_event', 10, 3 );
//per imprimir el content sense que ens tregui l'html //per imprimir el content sense que ens tregui l'html
function get_the_content_with_formatting ($more_link_text = '(...)', $stripteaser = 0, $more_file = '') { function get_the_content_with_formatting ($more_link_text = '(...)', $stripteaser = 0, $more_file = '') {
@ -152,23 +152,23 @@ function get_the_content_with_formatting ($more_link_text = '(...)', $striptease
return $content; return $content;
} }
//per imprimir l'excerpt indicant un nombre de caràcters màxim //per imprimir l'excerpt indicant un nombre de caràcters màxim
function the_excerpt_max_charlength($charlength) { // function the_excerpt_max_charlength($charlength) {
$excerpt = get_the_excerpt(); // $excerpt = get_the_excerpt();
$charlength++; // $charlength++;
if(strlen($excerpt)>$charlength) { // if(strlen($excerpt)>$charlength) {
$subex = substr($excerpt,0,$charlength-5); // $subex = substr($excerpt,0,$charlength-5);
$exwords = explode(" ",$subex); // $exwords = explode(" ",$subex);
$excut = -(strlen($exwords[count($exwords)-1])); // $excut = -(strlen($exwords[count($exwords)-1]));
if($excut<0) { // if($excut<0) {
echo substr($subex,0,$excut); // echo substr($subex,0,$excut);
} else { // } else {
echo $subex; // echo $subex;
} // }
echo "[...]"; // echo "[...]";
} else { // } else {
echo $excerpt; // echo $excerpt;
} // }
} // }
//afegir estils a l'editor //afegir estils a l'editor

View File

@ -3,7 +3,7 @@
// 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");
@ -24,20 +24,20 @@ function dades_obres_autor() {
$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];
$autor_tipo_resid = $custom['autor_tipo_resid'][0]; $autor_tipo_resid = $custom['autor_tipo_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 artista">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 artista" name="autor_obra" value="<?php if(!empty($autor_obra)) echo $autor_obra; ?>"></input>
<br /> <br />
<label class="dd">Data obra:</label> <label class="dd data-obra">Data obra:</label>
<input class="dd" name="data_obra" value="<?php if(!empty($data_obra)) echo $data_obra; ?>"></input> <input class="dd data-obra" name="data_obra" value="<?php if(!empty($data_obra)) echo $data_obra; ?>"></input>
<br /> <br />
<label class="dd">Tipo de residència:</label> <label class="dd tipo-residencia">Tipo de residència:</label>
<input class="dd" id="autor_tipo_resid" name="autor_tipo_resid" value="<?php if(!empty($autor_tipo_resid)) echo $autor_tipo_resid; ?>"></input> <input class="dd tipo-residencia" id="autor_tipo_resid" name="autor_tipo_resid" value="<?php if(!empty($autor_tipo_resid)) echo $autor_tipo_resid; ?>"></input>
<br /> <br />
<label class="dd">Periode de residència:</label> <label class="dd periode-residencia">Periode de residència:</label>
<input class="dd" id="autor_data_resid" name="autor_data_resid" value="<?php if(!empty($autor_data_resid)) echo $autor_data_resid; ?>"></input> <input class="dd periode-residencia" id="autor_data_resid" name="autor_data_resid" value="<?php if(!empty($autor_data_resid)) echo $autor_data_resid; ?>"></input>
<?php <?php
} }
@ -50,20 +50,20 @@ function dades_cal_activitats() {
$data_activitatEN = $custom['data_activitatEN'][0]; $data_activitatEN = $custom['data_activitatEN'][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 activitat-lloc">Lloc activitat:</label>
<input class="lateral" name="lloc_activitat" value="<?php if(!empty($lloc_activitat)) echo $lloc_activitat; ?>"></input> <input class="lateral activitat-lloc" name="lloc_activitat" value="<?php if(!empty($lloc_activitat)) echo $lloc_activitat; ?>"></input>
<label class="lateral">Data activitat:</label> <label class="lateral activitat-data-ca">Data activitat:</label>
<input class="lateral" name="data_activitat" value="<?php if(!empty($data_activitat)) echo $data_activitat; ?>"></input> <input class="lateral activitat-data-ca" name="data_activitat" value="<?php if(!empty($data_activitat)) echo $data_activitat; ?>"></input>
<label class="lateral">Fecha actividad:</label> <label class="lateral activitat-data-es">Fecha actividad:</label>
<input class="lateral" name="data_activitatES" value="<?php if(!empty($data_activitatES)) echo $data_activitatES; ?>"></input> <input class="lateral activitat-data-es" name="data_activitatES" value="<?php if(!empty($data_activitatES)) echo $data_activitatES; ?>"></input>
<label class="lateral">Activity date:</label> <label class="lateral activitat-data-en">Activity date:</label>
<input class="lateral" name="data_activitatEN" value="<?php if(!empty($data_activitatEN)) echo $data_activitatEN; ?>"></input> <input class="lateral activitat-data-en" name="data_activitatEN" value="<?php if(!empty($data_activitatEN)) echo $data_activitatEN; ?>"></input>
<br/> <br/>
<label class="lateral">Horari activitat:</label> <label class="lateral activitat-horari">Horari activitat:</label>
<input class="lateral" name="horari_activitat" value="<?php if(!empty($horari_activitat)) echo $horari_activitat; ?>"></input> <input class="lateral activitat-horari" name="horari_activitat" value="<?php if(!empty($horari_activitat)) echo $horari_activitat; ?>"></input>
<?php <?php
} }
@ -75,20 +75,20 @@ function afegir_dades_personals() {
$carrecEN = $custom['carrecEN'][0]; $carrecEN = $custom['carrecEN'][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 carrec-ca">Càrrec:</label>
<input class="lateral" name="carrec" value="<?php if(!empty($carrec)) echo $carrec; ?>"></input> <input class="lateral carrec-ca" name="carrec" value="<?php if(!empty($carrec)) echo $carrec; ?>"></input>
<label class="lateral">Cargo:</label> <label class="lateral carrec-es">Cargo:</label>
<input class="lateral" name="carrecES" value="<?php if(!empty($carrecES)) echo $carrecES; ?>"></input> <input class="lateral carrec-es" name="carrecES" value="<?php if(!empty($carrecES)) echo $carrecES; ?>"></input>
<label class="lateral">Job:</label> <label class="lateral carrec-en">Job:</label>
<input class="lateral" name="carrecEN" value="<?php if(!empty($carrecEN)) echo $carrecEN; ?>"></input> <input class="lateral carrec-en" name="carrecEN" value="<?php if(!empty($carrecEN)) echo $carrecEN; ?>"></input>
<br /> <br />
<label class="lateral">Email:</label> <label class="lateral email">Email:</label>
<input class="lateral" name="email" value="<?php if(!empty($email)) echo $email; ?>"></input> <input class="lateral email" name="email" value="<?php if(!empty($email)) echo $email; ?>"></input>
<label class="lateral">Telèfon:</label> <label class="lateral telefon">Telèfon:</label>
<input class="lateral" name="telefon" value="<?php if(!empty($telefon)) echo $telefon; ?>"></input> <input class="lateral telefon" name="telefon" value="<?php if(!empty($telefon)) echo $telefon; ?>"></input>
<?php <?php
} }
function incloure_at_home() { function incloure_at_home() {
@ -96,12 +96,12 @@ function incloure_at_home() {
$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 inici-option">Inici? </label>
<input class="lateral chk" type="checkbox" name="Inici" value="1" <?php checked( $Inici, 1 ) ;?> /> <input class="lateral inici-option" type="checkbox" name="Inici" value="1" <?php checked( $Inici, 1 ) ;?> />
<label class="lateral petit">Ordre:</label> <label class="lateral inici-order">Ordre:</label>
<input class="lateral petit" name="Ordre_inici" value="<?php if(!empty($Ordre_inici)) echo $Ordre_inici; ?>"></input> <input class="lateral inici-order" 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
@ -110,10 +110,10 @@ 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']);
@ -129,7 +129,7 @@ function save_details(){
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, "data_activitatES", $_POST['data_activitatES']); update_post_meta($post_id, "data_activitatES", $_POST['data_activitatES']);
update_post_meta($post_id, "data_activitatEN", $_POST['data_activitatEN']); update_post_meta($post_id, "data_activitatEN", $_POST['data_activitatEN']);
@ -137,4 +137,4 @@ function save_details(){
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
?> ?>

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(){
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("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("equip","Dades personals","afegir_dades_personals","page","normal","high");
}
add_action( 'init', 'anys_artistes', 0 );
function anys_artistes() { // function admin_init(){
register_taxonomy('anys', array('page'), array('public' => true, 'label' => 'Anys', 'singular_label' => 'Any', 'rewrite' => true)); // 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("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("equip","Dades personals","afegir_dades_personals","page","normal","high");
// }
// add_action( 'init', 'anys_artistes', 0 );
function dades_obres_autor() { // function anys_artistes() {
global $post; // register_taxonomy('anys', array('page'), array('public' => true, 'label' => 'Anys', 'singular_label' => 'Any', 'rewrite' => true));
$custom = get_post_custom($post->ID); // }
$autor_obra = $custom['autor_obra'][0];
$data_obra = $custom['data_obra'][0];
$autor_data_resid = $custom['autor_data_resid'][0];
//here we construct the fields for the backend user interface
?>
<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>
<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>
<label class="dd">Data obra:</label>
<input class="dd" name="data_obra" value="<?php if(!empty($data_obra)) echo $data_obra; ?>"></input>
<br/>
<?php
}
function dades_cal_activitats() { // function dades_obres_autor() {
global $post; // global $post;
$custom = get_post_custom($post->ID); // $custom = get_post_custom($post->ID);
$data_activitat = $custom['data_activitat'][0]; // $autor_obra = $custom['autor_obra'][0];
$lloc_activitat = $custom['lloc_activitat'][0]; // $data_obra = $custom['data_obra'][0];
$horari_activitat = $custom['horari_activitat'][0]; // $autor_data_resid = $custom['autor_data_resid'][0];
//here we construct the fields for the backend user interface
?>
<label class="lateral">Lloc activitat:</label>
<input class="lateral" name="lloc_activitat" value="<?php if(!empty($lloc_activitat)) echo $lloc_activitat; ?>"></input>
<label class="lateral">Data activitat:</label>
<input class="lateral" name="data_activitat" value="<?php if(!empty($data_activitat)) echo $data_activitat; ?>"></input>
<br/>
<label class="lateral">Horari activitat:</label>
<input class="lateral" name="horari_activitat" value="<?php if(!empty($horari_activitat)) echo $horari_activitat; ?>"></input>
<?php
}
function afegir_dades_personals() { //here we construct the fields for the backend user interface
global $post;
$custom = get_post_custom($post->ID);
$carrec = $custom['carrec'][0];
$email = $custom['email'][0];
$telefon = $custom['telefon'][0];
//here we construct the fields for the backend user interface
?> ?>
<label class="lateral">Càrrec:</label> <!-- <label class="dd">Cognoms, nom de l'artista:</label> -->
<input class="lateral" name="carrec" value="<?php if(!empty($carrec)) echo $carrec; ?>"></input> <!-- <input class="dd" name="autor_obra" value="<?php //if(!empty($autor_obra)) echo $autor_obra; ?>"></input> -->
<label class="lateral">Email:</label> <!-- <label class="dd">Periode residència artista:</label> -->
<input class="lateral" name="email" value="<?php if(!empty($email)) echo $email; ?>"></input> <!-- <input class="dd" name="autor_data_resid" value="<?php //if(!empty($autor_data_resid)) echo $autor_data_resid; ?>"></input> -->
<label class="lateral">Telèfon:</label> <!-- <label class="dd">Data obra:</label> -->
<input class="lateral" name="telefon" value="<?php if(!empty($telefon)) echo $telefon; ?>"></input> <!-- <input class="dd" name="data_obra" value="<?php //if(!empty($data_obra)) echo $data_obra; ?>"></input> -->
<!-- <br/> -->
<?php <?php
} // }
function incloure_at_home() {
global $post; // function dades_cal_activitats() {
$custom = get_post_custom($post->ID); // global $post;
$Inici = $custom['Inici'][0]; // $custom = get_post_custom($post->ID);
$Ordre_inici = $custom['Ordre_inici'][0]; // $data_activitat = $custom['data_activitat'][0];
//here we construct the fields for the backend user interface // $lloc_activitat = $custom['lloc_activitat'][0];
// $horari_activitat = $custom['horari_activitat'][0];
//here we construct the fields for the backend user interface
?> ?>
<label class="lateral petit">Inici? </label> <!-- <label class="lateral">Lloc activitat:</label> -->
<input class="lateral chk" type="checkbox" name="Inici" value="1" <?php checked( $Inici, 1 ) ;?> /> <!-- <input class="lateral" name="lloc_activitat" value="<?php //if(!empty($lloc_activitat)) echo $lloc_activitat; ?>"></input> -->
<label class="lateral petit">Ordre:</label> <!-- <label class="lateral">Data activitat:</label> -->
<input class="lateral petit" name="Ordre_inici" value="<?php if(!empty($Ordre_inici)) echo $Ordre_inici; ?>"></input> <!-- <input class="lateral" name="data_activitat" value="<?php //if(!empty($data_activitat)) echo $data_activitat; ?>"></input> -->
<!-- <br/> -->
<!-- <label class="lateral">Horari activitat:</label> -->
<!-- <input class="lateral" name="horari_activitat" value="<?php //if(!empty($horari_activitat)) echo $horari_activitat; ?>"></input> -->
<?php <?php
} // }
// function afegir_dades_personals() {
// global $post;
// $custom = get_post_custom($post->ID);
// $carrec = $custom['carrec'][0];
// $email = $custom['email'][0];
// $telefon = $custom['telefon'][0];
//here we construct the fields for the backend user interface
?>
<!-- <label class="lateral">Càrrec:</label> -->
<!-- <input class="lateral" name="carrec" value="<?php //if(!empty($carrec)) echo $carrec; ?>"></input> -->
<!-- <label class="lateral">Email:</label> -->
<!-- <input class="lateral" name="email" value="<?php //if(!empty($email)) echo $email; ?>"></input> -->
<!-- <label class="lateral">Telèfon:</label> -->
<!-- <input class="lateral" name="telefon" value="<?php //if(!empty($telefon)) echo $telefon; ?>"></input> -->
<?php
// }
// function incloure_at_home() {
// global $post;
// $custom = get_post_custom($post->ID);
// $Inici = $custom['Inici'][0];
// $Ordre_inici = $custom['Ordre_inici'][0];
//here we construct the fields for the backend user interface
?>
<!-- <label class="lateral petit">Inici? </label> -->
<!-- <input class="lateral chk" type="checkbox" name="Inici" value="1" <?php //checked( $Inici, 1 ) ;?> /> -->
<!-- <label class="lateral petit">Ordre:</label> -->
<!-- <input class="lateral petit" name="Ordre_inici" value="<?php //if(!empty($Ordre_inici)) echo $Ordre_inici; ?>"></input> -->
<?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(){
// global $post;
// $post_id = $post->ID;
function save_details(){
global $post;
$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
?> ?>