How to get custom post type to display post meta on archive pages?
-
I have a created a custom post type but on category archive pages the post meta information is not displayed.
This is the code used to display the post meta:
<?php if ( 'post' === get_post_type() ) codilight_meta_1();?>
And this is the above function’s code:
function codilight_meta_1() { $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>'; } $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); $posted_on = sprintf( esc_html_x( '%s', 'post date', 'codilight' ), '<span class="entry-date">' . $time_string . '</span>' ); $byline = sprintf( esc_html_x( '%s', 'post author', 'codilight' ), '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>' ); echo '<div class="entry-meta entry-meta-1">'; echo $byline.$posted_on; if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo '<span class="comments-link">'; echo '<i class="fa fa-comments-o"></i>'; comments_popup_link( '0', '1', '%' ); echo '</span>'; } echo '</div>'; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to get custom post type to display post meta on archive pages?’ is closed to new replies.