Archived topic
Display post meta in sections
19 replies · Started by Are Martin on February 27, 2017
Viewing posts 16–20 of 20
Hmm, so it's not picking up the author name.
How are you applying this? Manually within Sections? Can you show me a screenshot? I'm just wondering if there's an alternate route we can use.
Just manually within sections. I have one section that simply contains content and I have the shortcode at the beginning.
So, it goes something like:
[entry_meta]
<h2 class="resources">Hello and welcome!</h2>
Try this instead:
add_shortcode( 'entry_meta', 'tu_entry_meta_shortcode' );
function tu_entry_meta_shortcode() {
if ( ! function_exists( 'generate_posted_on' ) ) {
return;
}
ob_start();
$post = get_post();
setup_postdata($post);
?>
<div class="entry-meta">
<?php generate_posted_on(); ?>
</div><!-- .entry-meta -->
<?php
$ret = ob_get_contents();
ob_end_clean();
return $ret;
}
That got it! Thank you!
No problem :)
This archived topic is closed to new replies.