Marketpress template help

Can someone point me in the direction of some info on how to create template pages for marketpress and also how to update and change pages such as the 'store' or 'marketplace' pages and how these fit in with the shortcodes..

Thanx :slight_smile:

  • DavidM
    • DEV MAN’s Mascot

    Hi Byronmarkets,

    Sure thing! There's a file in the MarketPress folder, \marketpress\marketpress-includes\themes\Themeing_MarketPress.txt, which goes through general instructions on that and lists the various template names.

    And basically, you'd just use your theme's respective template files, create copies of them, then rename them accordingly, and make your custom changes there.

    For instance, for single product listings, you'll likely create a copy of your theme's single.php file, rename it mp-product.php, then customize that how you'd like for it to work.

    Shortcodes really wouldn't be used in that case though. You'd instead rely on the same functions that the shortcodes rely on, which are detailed in \marketpress-includes\template-functions.php.

    The functions in that file are very well commented to make things clearer. Just let us know if you have any questions on it all!

    Thanks,
    David

  • shanx24
    • WPMU DEV Initiate

    Thanks. What should we do for the categories page.

    I've created a new "mp_store.php".

    Now what? How do I get the names of specific fields, buttons etc that I want to customize? I do not want to use shortcodes at all, I'm looking for access to specific fields directly.

    Thanks for any pointers.

  • shanx24
    • WPMU DEV Initiate

    This is the code I have in mp_productlist.php:

    <?php get_header(); ?>
    <?php
    // Get the posts
    $myposts = get_posts('numberposts=-1&orderby=title&order=ASC&<strong>category_name=products</strong>');
    ?>
    
    <?php foreach($myposts as $post) : ?>
       <?php setup_postdata($post); ?>
       <a href="<?php echo get_permalink(); ?>">
       <?php the_title() ?></span>
       <?php echo $the_content(); ?>
       </a>
    <?php endforeach; ?>
    
    <?php get_footer(); ?>

    This doesn't work. Firstly, it only shows regular posts, not products. What's the category name of products (I'm presuming MarketPress is using a custom post type and therefore a category?).

  • shanx24
    • WPMU DEV Initiate

    I discovered the following function in the template-functions.php:

    mp_list_products()

    This function has some hideous HTML code being written inside the function. Clearly, this is hardly customizable. I'm not going to edit code in a function to change the look and feel of the pages!

    Could someone please point me to how precisely this plugin thinks its users will customize it. How should I access the fields of a product title, product description, and other custom fields?

    Many thanks.

  • DavidM
    • DEV MAN’s Mascot

    Hi shanx24,

    The HTML in the function uses divs with classes so the styling can still be done via css. If you'd like the divs structured differently it would require some degree of coding.

    I'll run your further questions by the developer though to be clear, you're referring MarketPress' own custom fields rather than custom fields you've created, correct?

    -David

  • Aaron
    • CTO

    You don't need to create a new loop in the template file. Don't modify the query, just print things normally and use the various template functions provided to print things like buttons and prices inside the loop.

    As far as the store page, you can put whatever you want in there. By default it's just 3 shortcodes (there are template functions for those too).

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.