Skip to content

Instantly share code, notes, and snippets.

/functions.php Secret

Created June 29, 2017 21:04
Show Gist options
  • Save anonymous/89faf708abbf6333b9e13fa6794b04fb to your computer and use it in GitHub Desktop.
Save anonymous/89faf708abbf6333b9e13fa6794b04fb to your computer and use it in GitHub Desktop.
Wordpress - Post-Datum variabel anpassen
<?php //* mind this opening php tag
/**
* Wordpress - Post-Datum variabel anpassen
*/
add_shortcode( 'post_updated_date', 'rv_set_last_updated_date' );
function rv_set_last_updated_date( $atts ) {
$my_post_meta = get_post_meta($post->ID, 'Update', true);
if ( genesis_get_custom_field('Update') ) {
if ( genesis_get_custom_field('Update') == '1' ){
$last_updated .= 'Aktualisiert am ' . the_modified_date('j. F Y','','',false);
return $last_updated;
} else {
$last_updated .= 'Aktualisiert am '. genesis_get_custom_field('Update');
return $last_updated;
}
} else{
$published_on = get_the_time('j. F Y',false);
return $published_on;
}
}
//* Do those shortcodes when the post has been updated
add_filter( 'genesis_post_info', 'rv_post_info_filter' );
function rv_post_info_filter( $post_info ) {
$post_info = '[post_updated_date] von [post_author_posts_link] [post_comments before=""]';
return $post_info;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment