How to display a marketpress product list (using shortcode) without product images.

Marketpress has a "product list" widget that allows you to create a list of products without thumbnail images (unchecking "Show Thumbnail"), but I can't figure out how to use shortcodes to do the same. Thought it would be as straightforward as to add an attribute like 'image="false"' (or image="0") to the mp_list_products shortcode. Doesn't work. And checking "No" for Show Thumbnail in the Presentation Product List Settings page does the job, but it ruins other pages I want product images in grid form. Can it be done with shortcode?

  • Kimberly
    • Champion of Loops

    Hello there!

    Currently we don't have an image attribute for the shortcode that lists products.

    I was able to add the variable in the marketpress-shortcodes.php file

    I changed (starting on line 154)

    function mp_list_products_sc($atts) {
        extract(shortcode_atts(array(
      		'paginate' => '',
      		'page' => '',
      		'per_page' => '',
      		'order_by' => '',
      		'order' => '',
      		'category' => '',
      		'tag' => ''
      	), $atts));
    
        return mp_list_products(false, $paginate, $page, $per_page, $order_by, $order, $category, $tag);

    to

    function mp_list_products_sc($atts) {
        extract(shortcode_atts(array(
      		'paginate' => '',
      		'page' => '',
      		'per_page' => '',
      		'order_by' => '',
      		'order' => '',
      		'category' => '',
      		'tag' => '',
    		'image' => 'single'
      	), $atts));
    
        return mp_list_products(false, $paginate, $page, $per_page, $order_by, $order, $category, $tag, $image);

    Please note if you decide to make this change you will lose this capability upon upgrade.

    I will ask if we can add this as a feature request.

    Best,

    Kimberly

  • maxaud
    • The Crimson Coder

    Sadly the shortcode doesn't have this option.

    Before the content is displayed and output it passes it through a WordPress filter:
    $content .= apply_filters( 'mp_product_list_content', $product_content, $post->ID );
    You can remove the image from there.

    Alternatively you can add some CSS styles to your theme to hide the image from displaying in the widget.
    If you had a link to where you're encountering the issue I could provide the needed CSS rules.

  • drwebRED
    • New Recruit

    Thank you both for the help. Kimberly, I made those changes to the marketpress-shortcodes.php file and updated the page shortcode appropriately but still no go.. This is what I have for the shortcode:

    [mp_list_products paginate="true" page="1" per_page="10" order_by="title" order="DESC" category="lunch" image="false"]

    I've also tried it with: image="0"
    Now attempting to override it via CSS but am having a tough time figuring it out, there doesn't seem to be a simple class/property I can change. Guess my CSS skills are not as good as I thought :wink: In any case thanks for the help.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.