List only the Products of some category (post_types and categories)

How can I list only a category of my products?

I’ve searched in WordPress Support forums, and no luck.

I want to list one category of products.

I tried this:

query_posts( 'post_type=product&posts_per_page=3&product_category=41' );

And no luck.

  • espsjurs
    • The Incredible Code Injector

    Why not try the [mp_list_products] shortcode?

    From the admin area “MarketPress Shortcodes”:

    [mp_list_products] – Displays a list of products according to preference. Optional attributes default to the values in Presentation Settings -> Product List.

    Optional Attributes:

    “paginate” – Whether to paginate the product list. This is useful to only show a subset.

    “page” – The page number to display in the product list if “paginate” is set to true.

    “per_page” – How many products to display in the product list if “paginate” is set to true.

    “order_by” – What field to order products by. Can be: title, date, ID, author, price, sales, rand (random).

    “order” – Direction to order products by. Can be: DESC, ASC

    “category” – Limits list to a specific product category. Use the category Slug

    “tag” – Limits list to a specific product tag. Use the tag Slug

    Example: [mp_list_products paginate=”true” page=”1″ per_page=”10″ order_by=”price” order=”DESC” category=”downloads”]

  • Timothy
    • Chief Pigeon

    I would suggest the same as Espen, is that not an option?

    If you want to build it into a template or something then as quick way you can use do_shortcode()

    echo do_shortcode('[mp_list_products paginate="true" page="1" per_page="10" order_by="price" order="DESC" category="downloads"]');

    Take care.

  • randall_flagg
    • WPMU DEV Initiate

    I'm a developer, and tha's why I'm asking help here.

    I've always had problems with post_type and getting the right category. I really think that here is the better place to get support for the plugin I paid, since I'm trying to use for me.

    See my screenshot, that's what I need to get. But my only problem is using the category of the post_type product of the marketPress. I've been trying, but not getting it right yet.

    In the wordpress forum told me to look at

    Till now I couldn't get any result from it.

  • randall_flagg
    • WPMU DEV Initiate

    I got the result I wanted doing this!

    $args = array(
    'numberposts' => 4,
    'orderby' => 'post_date',
    'post_type' => 'product', //my type of post
    'taxonomy' => 'product_category', //the regular categories for post_types "product"
    'product_category' => 'destacado', //The name of the regular category
    'post_status' => 'publish'
    $destacados = get_posts( $args );
    foreach( $destacados as $post ) :
    //... My post information here

    With this I solved my problem! :slight_smile:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.