[Support request] Popular Posts By Catergory

Home Forums Support [Support request] Popular Posts By Catergory

Home Forums Support Popular Posts By Catergory

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #2369593

    Is there an easy way to display the most popular posts by catergory within the middle of a post?

    Is a plugin required?

    Could I do it with WP Show Posts?

    Customer Support

    Hi there,

    Related Posts by Category is possible with GenerateBlocks Pro Query Loop.

    Popular Posts is more complicated then that, how would you determine popularity ? Is it by the number of post views ? If so we don’t currently have a solution for that.


    Could i do related posts by catergory with Wp Show Posts?

    I don’t use generateblocks and i’m using classic editor

    Customer Support

    For sure.
    Follow these steps:

    1. In WP Show Posts create a new List, and name it related
    1.1 Set the Post Type to Post and Posts per page to the number of posts you want to display eg. 4.
    1.2 DO NOT set a taxonomy.
    1.3 Set the Columns, Images, Content as you would do any other list.
    1.4 Publish that.

    2. Now create a new Hook Element in Appearance > Elements.
    2.1 Add this PHP to the Element:

    <div class="wpsp-related-posts  grid-container">
    	<h2>Related Posts</h2>
    if ( is_single() ) {
        $cats =  get_the_category();
        $cat = $cats[0];
    } else {
        $cat = get_category( get_query_var( 'cat' ) );
    $cat_slug = $cat->slug;
    $list = get_page_by_title( 'related', 'OBJECT', 'wp_show_posts' );
    wpsp_display( $list->ID, 'tax_term="' . $cat_slug . '"' );

    2.2 Set the Hook to where you want it displayed eg. generate_after_content

    2.3 Check Execute PHP

    2.4 Set the Display Rules to Posts > All Posts

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.