Select Category not to show on Marketplace

Hi, I am using the Gridmarket theme, how would I add a category that I do not want to appear on the main marketplace page?

Thanks.

  • DavidM
    • DEV MAN’s Mascot

    Hi Fondeli,

    FrameMarket uses a built in function framemarket_mp_list_global_products() to list the marketplace products, it's on line 151 of /library/functions/marketpress.php.

    And from what it looks like, the only way I imagine you could list all but one category is to alter the actual query on line 177 which is as follows:
    $query = "SELECT blog_id, p.post_id, post_permalink, post_title, post_content FROM {$wpdb->base_prefix}mp_products p INNER JOIN {$wpdb->base_prefix}mp_term_relationships r ON p.id = r.post_id INNER JOIN {$wpdb->base_prefix}mp_terms t ON r.term_id = t.term_id WHERE p.blog_public = 1 AND t.type = 'product_category' AND t.slug = '$category'";

    That last AND t.slug = '$category', you could probably just change to AND t.slug != '$category' so that it will exclude the category you call the function with. Alternatively, you could hard code it so it always excludes that category, by just replace $category with your specified category.

    There's not a way I could see to exclude more than one category, though with some serious customization I'm sure that could be done.

    Hope that helps!

    -David

  • Fondeli
    • The Bug Hunter

    Hi David,

    Thanks for that, but that then shows all but the specified category in all the marketpress categories, I just want to exclude a category on the home page, the global product list not the global categories, would there be a way to do that?

    Thanks.

  • Mason
    • DEV MAN’s Sidekick

    Hiya,

    This is a customization not available by default in the theme. You'd need to rewrite your own custom function based on the function framemarket_grid_mp_list_products on line 23 of marketpress.php inside framemarket/library/functions to exclude the particular category you're looking at.

    You could rewrite your own function and then call that function from mp_store.php rather than the default.

    Hope that helps!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.