WordPress.org

Ready to get started?Download WordPress

Forums

2nd featured image? (6 posts)

  1. Luke Urtnowski
    Member
    Posted 1 year ago #

    I set a featured image for all my custom posts, however I also have a picture in the sidebar for each page also.
    http://fixmysite.us/gmpc/
    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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year ago #

    thanks...
    That tutorial is a little over my head, i followed
    http://wp.smashingmagazine.com/2011/10/04/create-custom-post-meta-boxes-wordpress/
    instead and created
    http://fixmysite.us/gmpc/images/sidebar-image.jpg
    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
    Member
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.