voceconnect / multi-post-thumbnails

Adds multiple post thumbnails to a post type. If you've ever wanted more than one Featured Image on a post, this plugin is for you.
143 stars 63 forks source link

Set up with Wordpress #79

Closed steffib2010 closed 8 years ago

steffib2010 commented 8 years ago

I just activated the plugin and cannot see the box for secondary featured image when creating a new blog post. I checked on your Quick Start page and it mentions some code to be included in the functions.php. I am not so familiar with programming, so I am wondering if you can tell me where exactly that code needs to be inserted. And do both sections you mention in te Quick Start guide need to be included? It would be great to get the same kind of box you published in your screenshot section.

toby1kenobi commented 8 years ago

To add secondary images to posts, you should be able to put this code (adapted for your project) more or less anywhere in functions.php, I think:

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

This should cause the admin screens for posts to feature the secondary image meta box. However, if you add secondary images to your posts you'll also need to update the files that display posts to visitors to your site.

steffib2010 commented 8 years ago

Thanks, that worked great! And how do I show this secondary image? What do I need to include where to chose a thumbnail when posting this blog entry to facebook or pinterest?

toby1kenobi commented 8 years ago

Use the method the_post_thumbnail - see here https://github.com/voceconnect/multi-post-thumbnails/wiki#user-content-display-the-thumbnail

steffib2010 commented 8 years ago

Sorry, but where do I need to insert this code?

toby1kenobi commented 8 years ago

Wherever you want to display the image(s)! This will require you (or someone on your behalf) to edit your theme's code.

steffib2010 commented 8 years ago

Understood. But what if I don't necessarily want to display the secondary image but want to use it as an option for pinning the post to Pinterest or sharing on Facebook. I would like to have a choice between the featured image and the secondary image when sharing the post. Is that possible?

toby1kenobi commented 8 years ago

I'm sure it is, but again I think you'd need to actually edit the theme

chrisscott commented 8 years ago

Closing due to age. Please re-open if needed.