在数据库中,它将带有前缀的日期详细信息存储为\\u start和\\u end,因此您需要相应地更改元键。请看一下下面的代码。
<p>Start time details</p>
<p>Date: <?php echo get_post_meta($post->ID, \'_start_day\', true);?>.<?php echo get_post_meta($post->ID, \'_start_month\', true);?>.<?php echo get_post_meta($post->ID, \'_start_year\', true);?></p>
<p>Hour: <?php echo get_post_meta($post->ID, \'_start_hour\', true);?>:<?php echo get_post_meta($post->ID, \'_start_minute\', true);?></p>
<p>End time details</p>
<p>Date: <?php echo get_post_meta($post->ID, \'_end_day\', true);?>.<?php echo get_post_meta($post->ID, \'_end_month\', true);?>.<?php echo get_post_meta($post->ID, \'_end_year\', true);?></p>
<p>Hour: <?php echo get_post_meta($post->ID, \'_end_hour\', true);?>:<?php echo get_post_meta($post->ID, \'_end_minute\', true);?></p>
以防
$post->ID
不包含值,请尝试使用
get_the_ID()
.