Tagged: x
-
AuthorPosts
-
March 3, 2017 at 3:56 am #1393109
streetberlinParticipantHi Guys, I’m using the Icon stack for my blog
I need the following meta data to show both on the blog page and on the single post page
1. category (below title next to date)
2. tags (below post)
Follow up question: How can I add a custom sidebar to the blog and each single post?
Thank you so much
March 3, 2017 at 6:11 am #1393195
Paul RModeratorHi,
To achieve that, you can add this in your child theme’s functions.php
function x_icon_entry_meta() { $date = sprintf( '<span><time class="entry-date" datetime="%1$s">%2$s</time></span>', esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); // // Categories. // if ( get_post_type() == 'x-portfolio' ) { if ( has_term( '', 'portfolio-category', NULL ) ) { $categories = get_the_terms( get_the_ID(), 'portfolio-category' ); $separator = ', '; $categories_output = ''; foreach ( $categories as $category ) { $categories_output .= '<a href="' . get_term_link( $category->slug, 'portfolio-category' ) . '" title="' . esc_attr( sprintf( __( "View all posts in: “%s”", '__x__' ), $category->name ) ) . '"><i class="x-icon-bookmark" data-x-icon=""></i> ' . $category->name . '</a>' . $separator; } $categories_list = sprintf( '<span>%s</span>', trim( $categories_output, $separator ) ); } else { $categories_list = ''; } } else { $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 ) ) . '"><i class="x-icon-bookmark" data-x-icon=""></i> ' . $category->name . '</a>' . $separator; } $categories_list = sprintf( '<span>%s</span>', trim( $categories_output, $separator ) ); } if ( x_does_not_need_entry_meta() ) { return; } else { printf( '<p class="p-meta">%1$s%2$s</p>', $date, $categories_list ); } } function add_tags(){ if ( has_tag() ) : ?> <footer class="entry-footer cf"> <?php echo get_the_tag_list(); ?> </footer> <?php endif; } add_action('x_after_view_global__content', 'add_tags');Hope that helps.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1393109 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
