-
AuthorPosts
-
February 26, 2019 at 10:55 pm #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?
February 26, 2019 at 10:59 pm #1072020Just 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; }
March 1, 2019 at 6:03 pm #1073303Hi IdeaZone2550,
Please disable all the plugins except WooCommerce and let us check.
Best regards,
VictoriaMarch 1, 2019 at 10:58 pm #1073436Thanks 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
March 5, 2019 at 9:18 pm #1075081Hi Danielle,
What do you mean by “sharing the default post category with products”? This should not be happening.
Best regards,
VictoriaMarch 7, 2019 at 2:22 am #1075722In this case, we are sharing the default post categories with products.
March 12, 2019 at 7:30 am #1077676Hi,
I am not sure we do understand what you mean – is there a way to show us an example?
Best regards,
BasilisMarch 12, 2019 at 7:47 pm #1077927Hi 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
March 18, 2019 at 3:55 pm #1079922Hi,
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,
BasilisMarch 18, 2019 at 7:24 pm #1080027Hi, 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.
March 20, 2019 at 7:48 pm #1080994Hi 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 -
AuthorPosts
- You must be logged in to reply to this topic.