Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1072019

    I am having a really strange issue on a development site where the blog posts grid is displaying in random order. I tried turning off the plugins one by one and the culprit was WooCommerce. I have tried switching to the parent Enfold theme and the issue persists. The only way it goes back to normal is if I disable WooCommerce – any ideas?

    #1072020

    Just to follow up I have tried using this code in my child theme’s functions.php file and it does not work:

    add_filter('avia_blog_post_query', 'avia_modify_post_grid_query_desc');
    
    function avia_modify_post_grid_query_desc( $query ) {
    $query['orderby'] = 'date';
    $query['order'] = 'DESC';
    return $query;
    }
    
    #1073303

    Hi IdeaZone2550,

    Please disable all the plugins except WooCommerce and let us check.

    Best regards,
    Victoria

    #1073436

    Thanks for the reply. I did as suggested and the problem disappeared, so I tried turning on the plugins one by one again. The culprit was Toolset Types. I was using this plugin to add the default Category taxonomy to WooCommerce products – they need to have a shared taxonomy with Blog posts. So I disabled the plugin and added this code to my theme:

    function add_wp_taxonomy_to_cpt() {
     register_taxonomy_for_object_type( 'category', 'product' ); 
    }
    add_action( 'init', 'add_wp_taxonomy_to_cpt' );

    Now only WooCommerce is activiated and the problem still exists. It appears to be related to sharing the default post category with products. This is a new problem – any help would be appreciated!

    Thanks,

    Danielle

    #1075081

    Hi Danielle,

    What do you mean by “sharing the default post category with products”? This should not be happening.

    Best regards,
    Victoria

    #1075722

    In this case, we are sharing the default post categories with products.

    #1077676

    Hi,

    I am not sure we do understand what you mean – is there a way to show us an example?

    Best regards,
    Basilis

    #1077927

    Hi Basilis,

    Thanks for your response. The site has now been launched at https://ruffell-brown.com/

    You can see the blog grid here: https://ruffell-brown.com/blog/

    Note the Random order.

    We are using this function to allow default blog post categories to be applied to Products:

    function add_wp_taxonomy_to_cpt() {
     register_taxonomy_for_object_type( 'category', 'product' ); 
    }
    add_action( 'init', 'add_wp_taxonomy_to_cpt' );

    This way, you can tag a blog post as “sheer blinds” and a product as “sheer blinds” as well under the same shared taxonomy. This function appears to affect only the blog grid using a category filter, making it appear in random order.

    We have been using this method for several years, but only very recently is it affecting this blog display.

    I hope this is clear.

    Thanks,

    Danielle

    #1079922

    Hi,

    Not sure if something have changed, but I have asked our developer to look into it.
    A quick question, if you remove the category from the list and leave only product – does it work?

    Best regards,
    Basilis

    #1080027

    Hi, If I use a Blog Posts element set to Blog Posts without specifying categories, it does work as expected; however, there are a bunch of categories we don’t want to show in the blog grid.

    #1080994

    Hi IdeaZone2550,

    You need to set the categories you want to show, otherwise you will get what you’re getting.

    If you need further assistance please let us know.
    Best regards,
    Victoria

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