Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #231235

    Hello Guys,

    Please help me out from this difficult situation.

    We are planning to use either GRID LAYOUT or FULL WIDTH MASONRY to display our blog posts in home page [http://hbjcapital.com/]. We have created a new taxonomy called Featured and we want to exclude that taxonomy list from appearing in the posts list [we do not want to use category for this purpose, thats why created the new taxonomy]. I tried editing the loop-index.php, but it seems the masonry elements are not using that loop file.

    The whole idea is to show a featured post on top of the page and remove that particular post when the posts are loaded later. And we dont want to use categories for that.

    Also please recommend if I should follow any other procedure as we are using a child theme.

    So please advise on what to do.

    #232029

    Hello Guys,

    Any update on this???

    #232039

    Hey!

    Please configure the Blog Posts option then look for “Do you want to display blog posts?” > select “Display entries from a custom taxonomy”.

    Regards,
    Ismael

    #232080

    Hello Ismael,

    I believe you didn’t understood my question. I am looking for a way to exclude a particular custom taxonomy from blog posts list.
    The only purpose of that custom taxonomy is to identify some special posts. We don’t want to use category or create another taxonomy tern.
    We will be using either full-screen masonry layout or grid layout. Editing loop-index.php didnt help.

    #233111

    Hey!

    If you want to remove the taxonomy from the category list on the top of a blog post (i.e. here: http://hbjcapital.com/stockbroker-radhakishan-damani-built-retail-business-d-mart/ the taxonomy/terms would be displayed next to “Investment Device”) you can use this filter code:

    
    add_filter('avf_exclude_taxonomies', 'avia_exclude_tax', 10, 3);
    function avia_exclude_tax($tax,$post_type,$id){
    $tax[] = 'following_users';
    return $tax;
    }
    

    Instead of “following_users” insert the name of your taxonomy. If you want to hide the taxonomy in the backend you must register it as “non public” taxonomy – see: http://codex.wordpress.org/Function_Reference/register_taxonomy (possible parameters which might help you: public and show_ui).

    Cheers!
    Peter

    #236706

    Hi Dude,

    I used your code and I am not able to see any differences.

    The scenario is like this we have some categories – like Investment Advice, Announcements, Market Outlook so and so. We have also created a custom taxonomy called Featured. Lets consider an example – a post is in category Announcements and will have the taxonomy featured set. We want to hide this particular post in full width masonry grid[as it has taxonomy featured set]. From the back-end we can choose either category or this custom taxonomy featured from dropdown list for “Which Entries?” setting of Masonry – but not the option to exclude particular taxonomy.

    So what we are trying to achieve is, whatever categories a post may have, if it has custom taxonomy “feature” set, it shouldn’t get displayed on the masonry grid. ie the masonry grid will be displayed using category setting – but some elements from it should be hidden based on our taxonomy. Hope you understood what I mean.

    Thanks for you continuous support – hoping for the best solution.

    • This reply was modified 10 years ago by hbjcapital.
    #236769

    Hey!

    Ah ok, now I understand the what you’re trying to achieve. You can use this code:

    
    if(!function_exists('avia_exclude_taxonomy_from_query'))
    {
        function avia_exclude_taxonomy_from_query($query, $params)
        {
            if(!empty($query['tax_query'][0]['terms']) && !empty($query['tax_query'][0]['taxonomy']))
            {
                $query['tax_query'][1]['taxonomy'] = 'featured';
                $query['tax_query'][1]['operator']= 'NOT IN';
            }
    
            return $query;
        }
    
        add_filter('avia_masonry_entries_query', 'avia_exclude_taxonomy_from_query', 10, 2);
        add_filter('avia_post_grid_query', 'avia_exclude_taxonomy_from_query', 10, 2);
        add_filter('avia_post_slide_query', 'avia_exclude_taxonomy_from_query', 10, 2);
    }
    

    Place it into the parent or child theme functions.php and replace “featured” with your taxonomy name.

    Regards,
    Peter

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