Forums

How to display different featured image in category view and post view? (7 posts)

  1. legitam
    Member
    Posted 4 months ago #

    Hi, I am working with the Rockwell theme and trying to figure out how to display a different featured image in my category view, and my post view. So I need the ability to display 2 seperate images.

    How can I go about setting this up? I tried to look for plugins and couldnt find any.

  2. Thrive Internet Marketing
    Member
    Posted 4 months ago #

    The Multiple Post Thumbnails Plugin should do the trick!

  3. legitam
    Member
    Posted 4 months ago #

    Hi, yes I am not sure how to edit my theme though to make it work.

    I would have to edit this part I believe:

    <?php the_post(); ?>
    <div class="content" id="blog-single-7">
    <?php get_single_post_title(); ?>
    <?php get_post_mainimg($post->ID, 940, 340); ?>

    and would i just change get_post_mainimg to get_secondary_image?

  4. Thrive Internet Marketing
    Member
    Posted 4 months ago #

    You would change it to something like this

    MultiPostThumbnails::the_post_thumbnail('post', 'secondary-image', NULL, 'post-secondary-image-thumbnail');

    you can find more info about how to set this up in the plugin's faq section.

  5. legitam
    Member
    Posted 4 months ago #

    would that be the code i place in the functions.php or in the get_post_mainimg area? I had a look at the FAQ's, but not being a programmer makes things pretty difficult to understand.

  6. shaile
    Member
    Posted 4 months ago #

    Install Multiple Post Thumbnails

    and paste this code in your function.php

    /* Add secondary thumbnail (featured image) in page */
    $thumb = new MultiPostThumbnails(array(
     'label' => 'Secondary Image',
     'id' => 'secondary-image',
     'post_type' => 'page'
     )
    );
    /* Add secondary thumbnail (featured image) in posts */
    $thumbPost = new MultiPostThumbnails(array(
     'label' => 'Secondary Image',
     'id' => 'secondary-image',
     'post_type' => 'post'
     )
    );

    [Please post code or markup snippets between backticks or use the code button.]

    and the find secondary image area ...like

    http://example.com/?attachment_id=721

    and upload the second image..

  7. Thrive Internet Marketing
    Member
    Posted 3 months ago #

    Sorry, I'll be sure to use the code button next time!

    Thanks Shaile!

Reply

You must log in to post.

About this Topic

Tags