Marketpress: multiple pictures coding help

Okay so I am trying to give Marketpress the ability to have multiple pictures for a product.

I am doing this by editing the theme files along with a plugin called "Multiple Post Thumbnails"

I can't post snippets the way I would like so I will continue in a reply. Look below for the reply and continuation

  • josh

    I am a total newbie at all this so be easy on me. And this is a question for help not a tutorial quite yet. Hopefully with the help of members and WPMU Dev we can get a temporary solution until Marketpress supports multiple pictures in a neater manner than the gallery function or inserting into description.

    Okay, forgot to mention I know that this topic has been talked about and product feature suggestion has already been touched on also. But I can't wait and it is compromising my site especially since it is on a multisite config and my users need to be able to post multiple pics in an easy logical manner.

    So i added this to my theme (Framemarket/gridmarket) functions.php file. To clarify I added it to gridmarket's function.php file.

    <?php
    if (class_exists('MultiPostThumbnails')) {
    
    new MultiPostThumbnails(array(
    'label' => 'Secondary Image',
    'id' => 'secondary-image',
    'post_type' => 'product'
     ) );
    
     }

    This enabled a second meta box to insert an image in the Marketpress "add a product page" See "screenshot 1":

    Then I went to the mp_product.php (also found in the gridmarket theme folder.
    I added the following after line 10. To clarify the following code starts on line 11 and ends on 19. The original code that was on line 11 should now be on line 20 after inserting the following code.

    <?php
    
    if (class_exists('MultiPostThumbnails')) :
    
    MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'secondary-image');
    
    endif;
    
    ?>

    This gave me encouraging results.
    See "Screenshot 2"

    Okay so I know this isn't much and this can be achieved using the gallery function, but the point is that a user can now use the side bar to add images. they don't have to mess around with the gallery thing. In addition you can use a plugin like "Drag and Drop Featured Image" to enable the drag and drop upload feature.

    What I want to ask of you more knowledgeable people, is how can we turn this into a more useful modification?

    Things i had in mind - being able to somehow add all the pics as thumbnails next to the main featured image and then when a user clicks on them they would enlarge (without taking you to another page, forgot what that is called. modal or something like that)

    How can we turn this into a nicer display? so that buyers would come in and look at the product and not get distracted by how horrible and un-standard the additional pics are.

  • josh

    First Screen shot was to big, so here it is.

    Also a correction, I tried using the drag and drop plugin, but it only worked for the featured image not the secondary image. The drag and drop does work with other plugins that add more featured images, but those plugins would require you to go in and edit them since MP uses custom post types. They call them "products".

    So again any suggestions, aditional custom coding, or ways to integrate a plugin that would make this a lot nicer, and more functional?

  • PC

    Hey there Josh,

    Thanks for posting on the forums.

    Getting into the code is something I personally avoid unless we are left with no options.

    While we do not have the feature of adding multiple images in a marketpress product there are a few other ways.

    Here is one : http://www.marketpressthemes.com/

    The site is managed by one of our community members and they have designed a whole theme around our MarketPress plugin. I think they have a Pro theme which supports multiple product images out of the box.

    Alternatively, you can use a gallery plugin. So you have one featured image of the product and rest of the images are added to the product description field and then a user clicks on that, it opens a light box and you are done.

    Example : http://wordpress.org/plugins/lightbox-gallery/faq/

    Can you kindly try and see if that helps ?

    Cheers, PC

  • josh

    Hi @PC

    Thanks for those suggestions! I have seen the PRO theme offered at marketpressthemes.com. It looks really nice, and I will probably get my hands on it soon enough.

    In my case however, I am creating a multisite and allowing users to choose from a wide variety of themes for their store. So the solution has to be available for every theme.

    I do like the gallery idea. I tried out the "Easy Image Gallery" plugin and I really liked that it added a metabox to the "add a product" page in MarketPress. That is what I was looking for in regards to being user friendly.

    Now is there a way to add this gallery to the side of the product image? instead of in the description/post field?

    I know that it would require some custom coding to a file (likely the mp_product.php) but I also think it would be something really easy for the more knowledgeable. I'm guessing something with hooks??

    Here is a link to the plugin I used: http://wordpress.org/plugins/easy-image-gallery/

    And here is some info listed from the link that I think is relevant to being able to add it next to the featured image instead of in the description section.

    Shortcode Usage
    Use the following shortcode anywhere in the content area to display the gallery

    [easy_image_gallery]

    Template Tag Usage
    The following template tag is available to display the gallery

    if( function_exists( 'easy_image_gallery' ) ) {
        echo easy_image_gallery();
    }

    If you use the template tag above, you will need remove the default content filter:

    remove_filter( 'the_content', 'easy_image_gallery_append_to_content' );

    Developer Friendly
    Modify the gallery HTML using filters
    Developed with WP Coding Standards
    Easily add your preferred lightbox script via hooks and filters
    Easily unhook CSS and add your own styling
    Pass in a different image size for the thumbnails via filter

  • josh

    I noticed that I wasn't to clear when I said:

    Now is there a way to add this gallery to the side of the product image? instead of in the description/post field?

    I know that it would require some custom coding to a file (likely the mp_product.php) but I also think it would be something really easy for the more knowledgeable. I'm guessing something with hooks??

    I attached another image to show Where I am talking about. This is for the gridmarket theme. But maybe once we have the code we can stick into other theme files to replicate it. I know this wouldn't be consistent results as every theme is styled differently though, so it would require tweaking.

  • PC

    Hey there josh,

    Thanks for posting back and sorry for the delay here. I was not well and could not get to this any sooner.

    This is something which would require custom modification to the plugin core if you want to add multiple images. Here is a starting point : http://www.wpbeginner.com/plugins/how-to-add-multiple-post-thumbnails-featured-images-in-wordpress/

    Ideally the best way to do this is adding the images to the content area as a gallery as if you add multiple featured images, they will appear all at once and wouldn't look that great.

    Would the above approach work ?

    Cheers, PC

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.