Related post in wp show posts in generatepress theme
-
Hello,
I have found that code to display wp show posts pro as a related posts in my single post page.
<div class="wpsp-related-posts1 grid-container"> <h2>Related Posts</h2> <?php if ( is_single() ) { $tags = get_the_tags(); $tags_list = []; foreach ($tags as $tag) $tags_list[] = $tag->slug; $tag_string = implode( ', ', $tags_list); } else { $tag_string = get_tag( get_query_var( 'tag' ) ); } $list = get_page_by_title( 'related', 'OBJECT', 'wp_show_posts' ); wpsp_display( $list->ID, 'tax_term="' . $tag_string . '"' ); ?> </div>
But it doesnt work, can you please help. I am adding this code a hook, after the content in elements.
I just want to display related posts by tags, in my specified place under the single posts content, before footer.
Please let me know.
Thank you so much!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Related post in wp show posts in generatepress theme’ is closed to new replies.