Themeing Auto Generated MarketPress Product Display page


I am trying to setup Matketpress but I cannot for the live of me figure out how to use the template_functions.php file to setup my own products page. I have read all the information available on the support forums and have understood the heirarchy as to how MarketPress looks for templates etc but I am not able to figure out the virtual pages/posts that are created for each product when they are added.

How do I use the template for an individual products so that the default Add to Cart, product description etc are pulled but I use my own template.

Any help with this will be highly appreciated.

  • Milan

    Hello ZeeMaster

    Hope you are well today and thanks for asking us. :slight_smile:

    If you just want to tweak styling of product page, I have another approach for you than overriding templates. :slight_smile:

    All you need to do is to just create folder named marketpress-styles in wp-content directory of your site. Once you do that just create file with ".css" extension. You can give it any name.

    Prefix that file's content with this content,

          MarketPress Style:  YOUR_STYLE_NAME

    There you can write all of your css rules for product templates. And to identify selectors of product template you can developer tools of any good browser, I personally suggest chrome and firefox for this. You can google about their developer tools if you do not know how they offer it.

    But if this approach is not possible for you to implement, you can always override MarketPress's templates and to know how, please refer file \wp-content\plugins\marketpress\ui\themes\Theming_MarketPress.txt.

    Hope this helps you. :slight_smile: If you have anymore question of queries please do let me know. :slight_smile:

  • ZeeMaster

    Hi Milan,

    Thank you for that. Yes I did see the CSS guide but unfortunately what I am trying to do is not going to be completely handled by CSS.

    What I am trying to do is create a full page template that would pull all the relevant information for marketpress.

    What is currently happening is that when I create an mp_product.php template and add all the genesis hooks and filters etc to make it a full width page etc. When the product page loads, it only displays the discription.

    If you can tell me how can I call the functions that are called by default on the product page like the product price, the quantity field, the add to cart button in a template, I would really appreciate it. I am sorry if all this sounds a bit stupid but I just cannot for the life of me figure out how to use the template_functions.php file.

  • Adam Czajczyk

    Hello ZeeMaster!

    Templating MarketPress is exactly the same as templating any WP theme with two exceptions:

    1. there's a need to take care of template hierarchy (but I understand that you're already familiar with this)

    2. there are some additional functions that can/should be used inside template files.

    That second point refers to the "template-functions.php" file that you're asking about. This file is located in the "/wp-content/plugins/marketpress/includes/common/" folder and you actually don't use the file itself in any way.

    Instead you only call functions that are defined there in your custom templates. For example:

    - inside the file you'll find the "mp_product_price()" function that can be used to show product price

    - the function code in "template-functions.php" is this

    if ( ! function_exists( 'mp_product_price' ) ) :
    	 * Displays the product price (and sale price)
    	 * param bool $echo Optional, whether to echo
    	 * param int $post_id The post_id for the product. Optional if in the loop
    	 * param sting $label A label to prepend to the price. Defaults to "Price: "
    	function mp_product_price( $echo = true, $post_id = null, $label = true ) {
    		global $id, $mp;
    		$price_html = '';
    		$product = new MP_Product( $post_id );
    		$label = ( $label === true ) ? __( 'Price: ', 'mp' ) : $label; //should be empty from 3.0
    		$price_html .= $product->display_price( false );
    		$price_html = apply_filters( 'mp_product_price_html', $price_html, $post_id, $label, $product->display_price( false ) );
    		if ( $echo ) {
    			echo $price_html;
    		} else {
    			return $price_html;

    - as you can see, there's a description of what this function does and how to use it

    - the description says it can be used in a loop and if so the "$post_id" attribute (which defines post id, which equals product id) is not necessary so in order to display product price on a page you would use it this way:

    <?php mp_product_price( ); ?>

    If you can't see any function that you need there it means that the regular WP template function can be used. MarketPress products are posts of custom post type so WP template functions are supported.

    I hope that helps!
    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.