2nd featured image? (6 posts)

  1. Luke Urtnowski
    Posted 4 years ago #

    I set a featured image for all my custom posts, however I also have a picture in the sidebar for each page also.
    It would be great if I could add a function in my functions.php file which can set it straight from the edit page (just like I declare a featured image) like call it "Sidebar Image" or something.
    Right now, the way im doing this is to create a page template for each of my pages (about 30) and seems excessive.

  2. michael.mariart
    Posted 4 years ago #

    There's two ways of doing this. Both of them require some programming work.

    The first is to use the standard ordering in the gallery area for your posts/pages. Set it up so that all of the images are ordered and set 1 as your featured image. That way you can get the images in your template code and retrieve the second image to be used for a second feature.

    The second way is to set up an additional meta-box area for your pages/posts that has a list of some sort with the available images in it. That will let you select which image that you want to display and save that as a custom vale for that post. Then in your template you can get the custom values, find if there is a secondary featured image and display it if there is.

  3. Luke Urtnowski
    Posted 4 years ago #

    the first way seems like it shouldn't take too long.
    But Im really lost on the second method and since I really want to learn wordpress, can you explain it a little more?

  4. Chris Lema
    Posted 4 years ago #

    If you want to learn about custom meta-boxes, there are four great tutorials here: http://wp.tutsplus.com/tutorials/reusable-custom-meta-boxes-part-1-intro-and-basic-fields/

  5. Luke Urtnowski
    Posted 4 years ago #

    That tutorial is a little over my head, i followed
    instead and created
    to create the sidebar image meta box, Id really want to change the html inside of it so that it functions just like the featured image one and allows you to set an image in the sidebar, Is there a way to do that?

  6. Luke Urtnowski
    Posted 4 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.