WordPress.org

Forums

First image from post (2 posts)

  1. Nichtschwimmer
    Member
    Posted 7 years ago #

    Hello!

    I wan't to get the first image of e.g. the latest 6 posts
    from a specific category and show the first image of everey
    post e.g. in the sidebar.

    Is that possible? How?

    Thank You :)

    (sorry, my english is bad, i now ;))

  2. Alex Cragg
    Member
    Posted 7 years ago #

    By default, using the_content allows images to be displayed in a post, but you will also have text displayed. This is what is used on a normal single post view.

    On the other hand, the_excerpt can limit that text, but it cuts out images.

    So, how to go about it, I can think of two different methods, have a read on both and see what you think.

    1. Use the following plugin: The Excerpt Reloaded, and look at the allowedtags parameter.

    2. Read on Custom Fields, and then create a custom loop to show them.

    Post back if you have any further questions.

    Alex

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags