Created
March 14, 2019 09:36
-
-
Save WordPress-Handbuch/797563a63bbded687e589ecf0ec916a7 to your computer and use it in GitHub Desktop.
Extending a WordPress theme's single.php template file to output custom post fields (meta-boxes), (tested for Twenty Nineteen)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( $custom = get_post_custom() ) { | |
$location = ( isset($custom['location'][0] )) ? 'in ' . $custom['location'][0] : ''; | |
$eventdate = ( isset($custom['eventdate'][0] )) ? 'am ' . date_i18n(get_option( 'date_format' ), strtotime($custom['eventdate'][0])) : ''; | |
if ( !empty( $location ) || !empty ($location)) { | |
echo ' <h3 class="comments-area">Veranstaltung ' . $location . ' ' . $eventdate . '</h3>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment