How can I make individual product listing full width page?

Hi - I'm just experimenting with marketpress currently, so I can't point to a live example, but I would like to make individual product pages full width. Currently they seem to use the default page template with a widget area to the side. Is there a way I can make them full width?

  • Alexander

    Hi @Steve,

    For this it would be best to create a custom product template. There is a file called "Themeing_MarketPress.txt" in the themes folder of the plugin.

    Basically you start with your page.php file. Duplicate it, and rename it to mp_product.php

    Then replace the_content() with mp_product() to have it display a MarketPress template instead.

    At this point, you can remove the sidebar, and make other theme related changes.

    Best regards,

  • Steve

    Thanks for the reply but it's just a little sketchy in terms of me being able to achieve what I want to achieve...

    You say to take a copy of my page.php file - but that's the default page file that has the sidebar. In my theme the file with no sidebar is called page-FullWidth.php so that's the one I took a copy of.

    Here's the file:

     * @package WordPress
     * @subpackage U-Design
     * Template Name: Full-width page
    if ( !defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    get_header(); ?>
    <div id="content-container" class="container_24">
        <div id="main-content" class="grid_24">
    	<div class="main-content-padding">
    <?php       udesign_main_content_top( is_front_page() ); ?>
    <?php	    if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
    <?php               udesign_entry_before(); ?>
    		    <div class="entry">
    <?php                   udesign_entry_top(); ?>
    <?php			the_content(__('<p class="serif">Read the rest of this entry &raquo;</p>', 'udesign')); ?>
    <?php			udesign_entry_bottom(); ?>
    <?php               udesign_entry_after(); ?>
    <?php		( $udesign_options['show_comments_on_pages'] == 'yes' ) ? comments_template() : ''; ?>
    <?php	    endwhile; endif; ?>
    	    <div class="clear"></div>
    <?php	    udesign_main_content_bottom(); ?>
    	</div><!-- end main-content-padding -->
        </div><!-- end main-content -->
    </div><!-- end content-container -->
    <div class="clear"></div>

    I renamed it to mp_product.php and replaced the line
    <?php the_content(__('<p class="serif">Read the rest of this entry &raquo;</p>', 'udesign')); ?>

    <?php mp_product(__('<p class="serif">Read the rest of this entry &raquo;</p>', 'udesign')); ?>

    but that threw the error:
    Warning: Missing argument 2 for mp_product(), called in /home/amfinefu/public_html/wp-content/themes/u-design-child/mp_product.php on line 22 and defined in /home/amfinefu/public_html/wp-content/plugins/marketpress/marketpress-includes/template-functions.php on line 1985

    Have I misunderstood you?

    Please clarify...


  • Steve

    Further to this, there is something I don't understand:

    In the file "Themeing_MarketPress.txt" it states that " MarketPress searches your current theme folder for template files specific to store pages. If a template file does not exist it loads the theme's page template instead."

    Before I added the mp_product.php file it was working fine using (as this says) the theme's page template. It was working fine - it just wasn't displaying the way I want (full width). If the default page template works fine without being amended in any way, then why do I need to amend the full-width page template [by replacing the_content() with mp_product()] in order for it to work?

    ...I did try it without making that change, but it didn't work. It didn't throw an error, and did display the page, but did not display the product purchasing functionality.

  • Steve

    OK - from hunting around I see quite a few people have asked to be able to display the product pages full width.

    For my own part - I have pages like this one:
    where I want to have a "buy it now" or "add to cart" button with the relevant back end processing.

    I spent quite a bit of time on the responsive full-width layout of that page so I would like to keep it that way, but if I set it up as a marketpress product page I get this:
    which is ok except for not being full width.

    It's not full width because, in the absence of anything else, marketpress uses the default page.php template, so it strikes me that it should be possible (easy even) to say to marketpress "Don't use the page.php template, use the full-width template instead (which in my case is page-FullWidth.php)", and that it should then work just the same as it does with page.php, but full-width.

    Or am I missing something?

    Although I have come across a rather good article on customizing page templates for marketpress:
    I don't see why I should need to get into custom page templates when all I want to do is to say to marketpress "Instead of using page.php use this full-width page template in exactly the same way as you would use page.php."

    I hope this makes my question clearer.

  • Jack Kitterhing

    Hi there Steve,

    Hope you're well today and sorry about the extreme delay here.

    Did you get this working, I'd personally advise using a custom mp_product.php so as to not lose any changes when MarketPress is updated.

    If you'd rather not use that, take a look between lines 1132 and 1391 in marketpress.php, where it loads the templates.

    For example,

    line 1132 
    //otherwise load the page template and use our own theme
    			$wp_query->is_single = null;
    			$wp_query->is_page = 1;
    			add_filter( 'the_content', array(&$this, 'product_theme'), 99 );
    line 1391
    		//otherwise load the page template and use our own list theme. We don't use theme's taxonomy as not enough control
    			$wp_query->is_page = 1;
    			//$wp_query->is_singular = 1;
    			$wp_query->is_404 = null;
    			$wp_query->post_count = 1;
    			//$wp_query->queried_object_id = get_option('mp_store_page');
    			add_filter( 'single_post_title', array(&$this, 'page_title_output'), 99 );
    			add_filter( 'bp_page_title', array(&$this, 'page_title_output'), 99 );
    			add_filter( 'wp_title', array(&$this, 'wp_title_output'), 19, 3 );
    			add_filter( 'the_title', array(&$this, 'page_title_output'), 99, 2 );
    			add_filter( 'the_content', array(&$this, 'product_taxonomy_list_theme'), 99 );
    			add_filter( 'the_excerpt', array(&$this, 'product_taxonomy_list_theme'), 99 );


    Kind Regards

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.