Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @regme!

    Yes. The widget includes a field called “Category(ies) ID(s)” that you can use to specify the ID of the category.

    Thread Starter regme

    (@regme)

    Hi, Hector!
    I mean if looking post then show popular post for current category.

    Thread Starter regme

    (@regme)

    Have found your post on related theme. Have added my own html markup and set exclusion for current post form wpp list. Exlusion not working and my own markup isn’t showing. Also, disallowed WPP styles, but they are declaring in html code.

    Can you check if is it ok:

    <?php
    global $post;
    $categories = get_the_category($post->ID);
    $id = get_the_ID();//current post id
    
    foreach($categories as $category) {
        $myCats .= $category->cat_ID . ', ';
    }
    // remove trailing comma
    $myCats = rtrim($myCats, ', ');
    if (function_exists('wpp_get_mostpopular'))
        wpp_get_mostpopular( 'range="all"&limit=3&thumbnail_width=214&thumbnail_height=160&stats_views=0&excerpt_length=155&pid='.$id.'&cat="'.$myCats.'"&post_type=post&post_html="<li><div class=\"img\">{thumb}</div><div class=\"title\">{title}</div><div class=\"text\">{summary}</div></li>"' );
    ?>

    Thread Starter regme

    (@regme)

    Also, is thereway to enable worpdress thumbnail size supporting (thumbnail,medium,large).
    Sorry for posting all in one theme.

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hi there!

    Yep, that code should do what you want. Since I’m at it, here’s a revised version:

    <?php
    if ( function_exists('wpp_get_mostpopular') && is_single() ) {
    
        global $post;
        $myCats = '';
        $categories = get_the_category( $post->ID );
    
        if ( !empty($categories) ) {
    
            foreach( $categories as $category ) {
                $myCats .= $category->cat_ID . ', ';
            }
    
            // remove trailing comma
            $myCats = rtrim($myCats, ', ');
    
        }
    
        $args = array(
            "range" => "all",
            "limit" => 3,
            "thumbnail_width" => 214,
            "thumbnail_height" => 160,
            "stats_views" => 0,
            "excerpt_length" => 155,
            "pid" => $post->ID,
            "cat" => $myCats,
            "post_type" => "post",
            "post_html" => '<li><div class="img">{thumb}</div><div class="title">{title}</div><div class="title">{summary}</div></li>'
        );
        wpp_get_mostpopular( $args );
    
    }
    ?>

    Also, disallowed WPP styles, but they are declaring in html code.

    Just to be sure: did you hit the Apply button after setting “Use plugin’s stylesheet” to disabled?

    Also, is thereway to enable worpdress thumbnail size supporting (thumbnail,medium,large).

    Yes, but that feature is only available for the WPP widget.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Popular posts by categories’ is closed to new replies.