Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WP: how to change images in post excerpt?

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #26732
    meals303
    Member

    Hi folks,

    I am currently working on my category pages in WordPress and I have managed to style 90% of my posts that show up under a specific category.

    My problem is that I wish to display a different image for each post excerpt (not in the actual post), pretty much like css-tricks has in "video’s" sections, and I do not know where to look in WP Codex to find the relevant php code to call up an assigned image.

    I tried adding a div area in my category.php which defines an area for the image in CSS to sit in, and then in the actual post page (WP Dashboard) I inserted the image with the same class as used in the div. But it only showed up in the actual post full article page and not in the excerpt. This I now know is the wrong way… could anyone point me in the right direction?

    I would be most grateful for any help :)

    #66482
    TeMc
    Member

    I’d put the image in the actuall post content.

    If you’re using the_content() in your categorie-file then remember to put it after the <!–more–>.
    Then use a function on your category-template-file to extract that first image and display it in the div you have going.

    For the function see here: http://www.wprecipes.com/how-to-get-the … display-it
    Put that function in functinons.php of your theme, and call it in your category-file.

    Code:
    #66486
    meals303
    Member

    Thank you very much for that link TeMc, I will check that out right now and reply back with how I got on later.

    Cheers M :)

    #66497
    meals303
    Member

    No luck, I did everything as you suggested and the stuff from the tutorial but it doesn’t seem to display the image only the url source.

    *I tried inserting the img before the <!–more–> tag in the page editor & after it – no joy
    *I tried sticking an image in the Media db area on WP DSB and direct the image to there in stead off my server – no joy
    * Tried making my div container larger – no joy

    May have to look for a plugin instead. Thank you for your help though, appreciated! It may work for me if I do another WP site..

    ==EDIT==
    Sadly that didn’t work, some of the plugins I found were problematic for the style of my post – but I found this alternative which works fine, but it does not link to the first image in your post: http://blogigs.com/display-thumbnail-images-in-post-excerpts/ hope this helps others :)

    #66565

    Well you could either wait until WordPress 2.9 – when posts get thumbnail images – or use a custom field in your post as found in the article above. .

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Back End’ is closed to new topics and replies.