I'm new to WP, and I'm working on a custom theme.

Images in posts show up not just on the single post page, but on the blog/home page too(where the recent posts are listed). I want them to only show up at the single post page. I was wondering what code snippet is required in order achieve this, or at least what part of the code should apply to these matters.

  • 1
    You haven't given any context or code, but generally, you would wrap the affected code in the following condition: if ( is_single() ) { /* Add your affected code in here */ } – Pieter Goosen May 17 '15 at 19:40
  • The problem is, I'm so novice I don't even know what context should I provide. I have a page which shows the posts, and a page for a single post. What part of the codes should I give? Thank you! :) – lastnoob May 17 '15 at 20:24
  • I cannot unfortunately give anything more specific than what I have given due to the fact that I do not know how your images are called in your templates and due to you not being able to supply me with relevant context. This is quite specific to your theme. To be really honest here, your best solution here would then be to contact the theme developer for a specific answer, but as I said, the solution is very likely going to need the implementation of the code as given in my first comment – Pieter Goosen May 18 '15 at 5:55

If you are talking about a featured image on each post, the wordpress hook is the_post_thumbnail(); You may be able to find that on the template you are working with and remove it? Images embedded in posts or pages would be different.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.