• Resolved Halimah

    (@halimah)


    Please help! How do I exclude a category from related posts using a function/shortcode. Using the dashboard won’t work for me.

    On my site all posts belong either of 2 categories namely Problems and Solutions. (A problem can be related to many solutions and a solution can be related to many problems).

    So on the post page, I want to have 2 levels of Related posts.
    (1)Related posts(Problems)
    (2)Related Posts(Solutions).
    Now if I add “get_related_posts_thumbnails()” twice to my “single.php” file I have the two layers of the related posts that I want, but now what is left is to specify that the first one should exclude Solutions(Category2) and the second should exclude Problems(Category1).

    Thanks a lot

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Muhammad Arslan

    (@wparslan)

    Hey, Halimah!
    Related Posts Thumbnails Plugin doesn’t have that kind of shortcode available right now.
    However, we have noted this functionality and will provide it in a future update.

    Thank you.

    Thread Starter Halimah

    (@halimah)

    Hi @wparslan!
    Thanks a lot for your response. I look forward to the update.

    Regards

    Plugin Support Muhammad Arslan

    (@wparslan)

    Hello @halimah
    We have added the functionality which enables you to exclude a number of posts from related post thumbnails.

    paste the following code in your functions.php of your child theme.

    add_filter( 'rpt_exclude_post', 'related_posts_thumbnails_exlude_posts' );
    
    function related_posts_thumbnails_exlude_posts(  ) {
        return array('comma separated id/s of post/s');
    }
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to exclude a certain category from related posts using a shortcode/function’ is closed to new replies.