• Okay, i am displaying recent posts in a category on my index page. I want to display images with it. How do i do this? I tried using the_meta() but that didn’t work. It just displays the text of it in a list instead of showing the image.

    Although, i’m not really sure i’m dong the custom field thing right, because if you look at an entry itself, the image doesn’t show up. So can someone help me with this?

    Also, how can i removed the list styling? I went through my style sheet and added list-style:none anywhere i thought it relevant, but it’s still showing up like that (see how there is a circle off to the left and the image name is indented under the post title).

    ANY help would be greatly appreciated. No one likes to respond to my posts on here, and i always search the forum first.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Firstly it would help if you post a link to your site. You can use the_meta() to display images using the following code:

    <?php $image = get_post_meta($post->ID, 'image', $single = true);
    $image_alt = get_post_meta($post->ID, 'image alt', $single = true);
    if (!empty($image)){?>
    <img src="<?php echo $image; ?>" alt="<?php if(empty($image_alt)) { echo $image_alt; } else { echo the_title(); } ?>" />
    <?php } ?>

    Put the url of the image in the meta field image and the alternative text in image_alt.

    You could try using a plugin such as Advanced Post Image

    Thread Starter Romans5Three

    (@romans5three)

    Whoops.
    https://dm.becksterslaboratory.com

    I’ve been having such bad experience with plugins. So many conflict with each other and no one replies to my questions about them. Half of them don’t have support forums. I’d rather utilize built-in features of wordpress.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying Images in Recent Posts’ is closed to new replies.