Support » Localhost Installs » no photos on posts main page

  • Hi All,

    I posted a few days ago, because I was trying to get header or labels to show up on my main post page, but I’ve realized that I should be able to get the photos that are on the individual post to show up on the main post page, but I’m only getting the text. I’ve watched a couple of videos and it seems like they are getting the photos, which of course is a tool that would make someone want to click on the post.

    I also can’t get a featured image to show up at the top of the main posts page, only the large text that I don’t like.

    I’m working on TWENTY TWENTY ONE using LOCAL so I can’t show the site.

    Too bad there is no way to upload photos here. Is that correct.

    Any help would be appreciated. It’s one of the last issues I’m dealing with.

    Thanks…Ian

    • This topic was modified 1 month, 3 weeks ago by James Huff. Reason: title de-capsed, please no shouting
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    You’re right, there’s no way to upload images to the forum. What you can do is post the image to a public photo sharing site like imgur.com (or any publicly accessible site), then just provide a link to the file here. The image will be unlikely to actually display here, but we know how to follow links 🙂

    A typical posts archive page doesn’t have its own featured image because it’s not a specific post or page. Featured images have to belong to a specific post or page. You could modify the archive template (usually the theme’s index.php template) to get a featured image that belongs to a specific post or page, but the featured image cannot belong to the archive page itself. For example, the post archive template can have code that says “show the featured image belonging to post ID# 1234”.

    Likewise, the template’s loop which outputs every post in a query could be coded to also display the current post’s featured image. In fact, the Twenty Twenty-one theme’s template should already do so by default. (line 22 of template-parts/content/content.php: twenty_twenty_one_post_thumbnail();)

    Thread Starter taomation2

    (@taomation2)

    Hi bcworkz,

    Sorry for the late reply. I didn’t see this until now.

    Thanks for the response.

    I don’t really care that much if there is an image on the posts archive page, but I am trying to get images in the list of blogs to represent each blog.

    Something like this would be great…

    https://astro-charts.com/blog/

    Again thanks for the reponse. I really appreciate it.

    Moderator bcworkz

    (@bcworkz)

    There’s a difference between images in blog content and featured images. From what you’ve described, it sounds like you haven’t specified featured images for each post, they only occur in post content. I say this because Twenty Twenty-one theme should be already be displaying featured images above every blog post on the posts archive page. It wouldn’t be showing posts in two columns by default, but that can be achieved through CSS changes.

    But for the sake of discussion, let’s say your theme just doesn’t display featured images. You can correct this by editing the template it uses for posts archives (usually index.php, YMMV). Within “The Loop”, add something like:
    the_post_thumbnail('medium');
    https://developer.wordpress.org/reference/functions/the_post_thumbnail/

    As I mentioned in my last reply, Twenty Twenty-one has its own custom function to display featured images.

    The names of WP featured image functions are rather confusing. Featured images are all referred to as “thumbnails”. But the image size can be any registered image size. The default is post-thumbnail size, but it could instead be medium or large as well.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.