how to populate loop with global products?

Hi, this may be a tricky issue but I'll try to explain as clear as I can:

We are testing MarketPress in a multisite where the main site will serve as global marketplace. Nothing special here.

We use the theme Portfolio Press which normally shows a post type 'portfolio' in a neat gallery of images -- but we adapted it so that it now takes the post type 'product' instead. This works very well to show a clean grid of products images on the home page of any shop in the network. This is done with a common:

$args = array(
	'post_type' => 'product',
	'posts_per_page' => $posts_per_page,
	'paged' => $paged );
query_posts( $args );

So far, still no problems at all.

But now we'd like to use the same theme (or at least the same method) on the root site of the network to display Global Products. The main site does not have any products of its own so right now the front page shows no images in the grid.

Would it be possible to populate the query with global products instead of the site specific post type 'product'? Or do we need to construct a whole new template based on/around a function like mp_list_global_products() or similar?

Thanks for any pointers :slight_smile:

  • Alexander
    • DEV MAN’s Mascot

    Hi @RavanH,

    The issue here, is that global products can't be queried like a normal post type. A global product index is created in custom MarketPress tables.

    mp_list_global_products would be the best place to start. MarketPress provides this so you can include a global listing in your themes. If you need more flexibility, you could make your own copy of the function.

    Best regards,

  • RavanH
    • The Crimson Coder

    Hi @Alexander Rohman - thanks for the explanation.

    Currently, in out custom theme the mp_list_global_products function gets the job done. But I was hoping I could get this to work with Infinite Scroll (by Jetpack) but I'm afraid it only works with 'regular' queries...

    Unless there is somebody who got (some form of) Infinite Scroll working with Global Products, I'll give up on this aspiration for now. :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.