Tagged: x
-
AuthorPosts
-
September 5, 2016 at 8:27 am #1161641
chrisjosephParticipantHi,
I’ve looked at responses to previous questions and am able to alter the meta appearing above a post by altering functions.php in a child theme.
However the client is now requesting that only the date appears above the post, and the author name and category tags appear beneath the post.
Can you advise on how to add the author name and category tags beneath each post? I’m using the Icon stack.
thanks!
September 5, 2016 at 8:51 am #1161666
chrisjosephParticipantHello,
I’ve worked out a way to do this, by
1) putting a copy of _content-the-content.php in x-child/framework/views/global
2) putting the following code between
<?php the_content(); ?>and<?php x_link_pages(); ?><?php $author = sprintf( '<span>Author: <a href="%1$s">%2$s</a></span>', get_author_posts_url( get_the_author_meta( 'ID' ) ), get_the_author() ); $categories = get_the_category(); $separator = ', '; $categories_output = ''; foreach ( $categories as $category ) { $categories_output .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) ) . '"> ' . $category->name . '</a>' . $separator; } $categories_list = sprintf( '<span>Tags: %s</span>', trim( $categories_output, $separator ) ); printf( '<p class="p-meta">%1$s %2$s</p>', $author, $categories_list ); ?>September 5, 2016 at 8:54 am #1161676
ThaiModeratorGlad you’ve sorted it out.
If you need anything else, please let us know 🙂
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1161641 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
