Modifying product pages in MarketPress


I'm trying to remove the buy now button from all product list pages. I can't find a simple way to do this so I'm using the filter mp_product_list_meta to change the outputted code.

This works fine for products in list view, but not in grid view.

In grid view the filter mp_product_list_meta is in a different location in its respective function (_mp_products_html_grid) compared to list view(_mp_products_html_list).

So how best do you suggest I change the product meta in grid view?


  • petemurray

    Hi Alexander

    I need to display the buy now and checkout for single product pages, just not the product/category list pages.

    The code in question is in template-functions.php

    line 1400 for list view

    $html .= '<div class="mp_product_meta">';
            $meta = mp_product_price(false, $post->ID);
            $meta .= mp_buy_button(false, 'list', $post->ID);
            $html .= apply_filters('mp_product_list_meta', $meta, $post->ID);
            $html .= '</div>';

    and line 1452 for grid view

    $html .= '<div class="mp_one_tile ' . implode($class, ' ') . '">
                    <div class="mp_one_product"' . ($inline_style ? ' style="width: ' . $width . 'px;"' : '') . '>
                      <div class="mp_product_detail"' . ($inline_style ? ' style="width: ' . $width . 'px;"' : '') . '>
                        ' . $img . '
                        <h3 class="mp_product_name">
                          <a href="' . get_permalink($post->ID) . '">' . $post->post_title . '</a>
                        ' . $mp_product_list_content . '
                      <div class="mp_price_buy"' . ($inline_style ? ' style="width: ' . $width . 'px; margin-left:-' . $width . 'px;"' : '') . '>
                        ' . mp_product_price(false, $post->ID) . '
                        ' . mp_buy_button(false, 'list', $post->ID) . '
                        ' . apply_filters('mp_product_list_meta', '', $post->ID) . '

    I can filter the meta easily in list view, but the filter is in a different location in the second snippet and it's not clear to me how to use it.


  • petemurray

    Hi @Alexander

    I think I mislead you with my previous text - I want to remove the buy now / add to cart buttons and the price.

    Using a filter function, in the list view case, I can see that it's easy to make $meta = '' which removes the price and the buy buttons.

    However in the grid view example I can only add to the $html variable, I can't see how to remove only the price/buy now.

    I'm not very experienced at using filters so it's probably something fundamental which I'm missing. Could you give me an example of a filter function which I could use to remove the price/buy buttons in the grid view example?


  • Ben


    I hate giving links for answers, but in your case I think it might be appropriate.

    I think you will have to create a new product listing template for your theme.

    Here seems to be a pretty good tutorial for that to walk you through it:

    Then you can manually create it products listing display without the price and buy now button.

    Hope that provides the solution you are looking for, best of luck.