Tagged: ,

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

    We use the Masonry element to display thumbnails of portfolio posts on a portfolio post filtered by category. It is like looking at one product description and showing at the bottom of the post related products of the same category. Works fine, but we would like to show only OTHER portfolio items of the same category hide the one we are already looking at. Any idea how to do that?
    You can see it online here and at the bottom of the portfolio post you see the other portfolio posts within the same category. We like to avoid that the “Romantic Venice …” one is shown on itself. It is kind of recursive.

    #1187967

    Hey milano24ore,

    Thank you for the inquiry.

    hide the one we are already looking at. Any idea how to do that?

    It is possible to exclude the current post from the related section or from the Masonry element. You can use this filter in the functions.php file.

    
    function avia_masonry_entries_query_mod($query, $params)
    {
        if(is_singular('portfolio')) {
            $query['post__not_in'] = array(avia_get_the_ID());
        }
        return $query;
    }
    add_filter('avia_masonry_entries_query','avia_masonry_entries_query_mod', 10, 2);
    

    Best regards,
    Ismael

    #1188572

    Hi Ismael,
    You are the real MASTER. Thank you for that function. It works very well.
    Have a nice day.
    Wolfgang

    #1188738

    Hi,

    Did you need additional help with this topic or shall we close?

    Best regards,
    Jordan Shannon

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