Group Admins

  • Profile picture of Steve

WordPress Troubleshooting and Support

Public Group active 3 months, 3 weeks ago ago

WordPress support from our community

want custom field image to show with post titles and excerpts on archive pages

Tagged: ,

This topic contains 0 replies, has 2 voices, and was last updated by  Steve 6 years, 5 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1572

    Jay
    Participant

    along with every post on a certain site i manage, i have a Custom Field name=”portfolio-image” and Value=”http://www.mywebsite.com/wp-content/uploads/image1.jpg”

    i want these images from the custom fields to appear on my archive pages along with each post title and excerpt.

    in my twentyten child theme, this is the code from my category.php page: http://pastebin.com/Ap6Kt3Av. what do i put in there and where to make that happen? please advise. thanks in advance!

    #2738

    Steve
    Keymaster

    @jake— Use get_post_meta to pull and display custom fields.

    #2739

    Jay
    Participant

    @steve – how come not get_post_custom_values?

    i have this code elsewhere in the site: http://pastebin.com/b4nHYs9a

    still, either way, how do i incorporate the code into the category.php code? php is not my forte 🙁

    on a related note, how do i paste code in here and get it to show? i tried the backticks, but no dice.

    #2740

    Steve
    Keymaster

    get_post_custom_values is really for custom fields that contain an array. However, your example shows how you can use it by getting the first (and only instance) in the array: [0].

    Read the first two paragraphs of the codex.

    Have you tried your get_post_custom_values code in your category.php page? Seems like it would work.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.