Home › Forums › WoodMart support forum › Blog widget is not loaded for mega menu dropdown for some pages.
Blog widget is not loaded for mega menu dropdown for some pages.
- This topic has 3 replies, 3 voices, and was last updated 4 years, 4 months ago by Artem Temos.
-
AuthorPosts
-
July 30, 2020 at 3:57 pm #215478
kangjh0722ParticipantHi! I am using dropdown menu showing Blog widget of Woodmart.
It is working fine with most of the pages, but some pages doesn’t show the posts.
To be specific, it is working fine on homepage, blog&post pages, and product pages.
However, it does not work for a shop page and category pages.
Everything would be perfect if this works fine.
Thank you always.
Ju Hyung Kang
July 31, 2020 at 7:42 am #215602
Aizaz Imtiaz AwanKeymasterHello,
I have visited your website. Please deactivate all the third party plugins, activate parent theme.
Clear cache and check back. If the problem continues then provide admin panel login details of the website to check it myself and help you out accordingly.
Best Regards.
July 31, 2020 at 9:28 am #215642
kangjh0722ParticipantI found out that the following code lines are causing the issue thanks to your instruction.
/** * Sorting out of stock WooCommerce products - Order product collections by stock status, in-stock products first. */ class iWC_Orderby_Stock_Status { public function __construct() { // Check if WooCommerce is active if (in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')))) { add_filter('posts_clauses', array($this, 'order_by_stock_status'), 2000); } } public function order_by_stock_status($posts_clauses) { global $wpdb; // only change query on WooCommerce loops if (is_woocommerce() && (is_shop() || is_product_category() || is_product_tag())) { $posts_clauses['join'] .= " INNER JOIN $wpdb->postmeta istockstatus ON ($wpdb->posts.ID = istockstatus.post_id) "; $posts_clauses['orderby'] = " istockstatus.meta_value ASC, " . $posts_clauses['orderby']; $posts_clauses['where'] = " AND istockstatus.meta_key = '_stock_status' AND istockstatus.meta_value <> '' " . $posts_clauses['where']; } return $posts_clauses; } } new iWC_Orderby_Stock_Status; /** * END - Order product collections by stock status, instock products first. */
This code is for rearranging the products by the availability, which puts sold out products always in the end after showing all the available products.
Can you think of any trigger that is causing this problem in the above code?
If not, I would be really grateful if you teach me how to rearrange products by availability not harming the blog dropdown.
Thank you!
July 31, 2020 at 12:24 pm #215707
Artem TemosKeymasterHello,
It looks like this code affects global WordPress query loop and by doing this may break other posts queries including our blog widget. Sorry, but we don’t have a fix to this particular customization.
Kind Regards
-
AuthorPosts
Tagged: blog widget, html block, widget
- You must be logged in to create new topics. Login / Register