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.

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

    kangjh0722
    Participant

    Hi! 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

    #215602

    Hello,

    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.

    #215642

    kangjh0722
    Participant

    I 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!

    #215707

    Artem Temos
    Keymaster

    Hello,

    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

Viewing 4 posts - 1 through 4 (of 4 total)