0

I want to create a gallery similar to what WooCommerce does using multiple "featured image"(s). I have searched and searched, but i cant seem to find any solution to this (not even a thread covering it).

I know how to use featured images in a post-type, but it can only have 1 value.

Can it look like WooCommerce featured gallery as well? (looking like the native featured image box) so that the user dont have to click "Add new field" for each image, but can simply open the media modal and mark the images he want to use? - again similar to WooCommerce's featured gallery.

Thanks.

  • Without a code sample of what you've tried so far, no one's going to be able to help you. You're asking for help without even providing an URL to that 'featured gallery' you're talking about. Please improve your question. – cristian.raiber Mar 9 '15 at 15:57
  • Like i said above, i cant find any thread that covers this on the internet. All i am asking for is a hint, maybe a link to where i can find a thread that covers this. – Sillo Mar 9 '15 at 16:07
1

I found a solution to this.

I am using the plugin (No UI) Metabox that has this feature by default.

This is the code i used to achieve my desired result:

add_filter( 'rwmb_meta_boxes', 'prefix_register_meta_boxes' );

function prefix_register_meta_boxes( $meta_boxes )
{
    $prefix = 'rw_';


    $meta_boxes[] = array(
        'title'    => 'Media',
        'pages'    => array( 'bestilling'),
        'fields' => array(
            array(
                'name' => 'URL',
                'id'   => $prefix . 'url',
                'type' => 'file_advanced',
            ),
        )
    );

    return $meta_boxes;
}
  • Is there any link you can share for the plugin you've used? The "(No UI)" part confused me. I'm looking for the exact same thing for having a gallery in custom posts. – otinanai Sep 16 '16 at 18:58
  • 1
    Sorry for the delayed answer. Yes, i used Metabox plugin, which can be found here [link]metabox.io/[/link]. What i mean by No UI is that the plugin has no user interface or configurations. It only adds extended functions for fields and post types. – Sillo Sep 18 '16 at 20:47
  • That's great! I've used it to create the gallery with the "image_advanced" type. Thank you for all your help! – otinanai Sep 21 '16 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.