I’m wondering if there is some sort of tag that can be used (or some other methodology) to make it so that images in a post do not appear in the post excerpt. I just want certain posts to have images within the post, but to not display an image in the post excerpt.
If your theme uses
the_excerpt()all images will be removed from the post teaser.
is there any chance I can apply that code to a single post? I want thumbnail images on some posts, and not on others. Where could I add this to get that effect? in the html of the actual posting?
so putting that in the posting html does nothing, so that answers that. hmm, so it seems there is no way to customize this, it’s all or nothing? image thumbs on all post excerpts (with posts containing images) or none at all?
I want thumbnail images on some posts, and not on others.
So don’t add images to some posts…
i guess i want more control over things than are possible, according to your feedback. I will give you an example of what I was trying to do, so you can at least understand where I am coming from. For my most recent post, there were no images needed in it. However, I wanted to punctuate the end of the post with the company logo.. it looked nice. However, I didn’t want it to appear in a thumbnail in the blog excerpt because right beneath the header of the blog, would be kinda redundant logo wise (as the logo is prominently featured in the header.) So I guess I should just give up on this desire? Not do-able?
In that particular instance, using
<?php the_excerpt();?>should work as it will strip out the image along with any other text formatting tags. The problem arises when you want some post teasers to include images and others to be just plain text. If you do want mix’n’match, then the only real option is to use
<?php the_content();?>in conjunction with the
<!--more-->tag. Then you can use:
– No images in teaser = insert images after the
– Want images in teaser = insert images before the
Does that make sense?
hmmm, so your suggesting to use <?php the_content();?>. Would I put this code into the actual post, similarly to how we use the <!–more–> tag? And if so, does it matter where I place it within the post?
So if I get what your saying. Using <?php the_content();?> gives me the option to put images before or after <!–more–>, in order to get my desired result, as you’ve detailed above. That sounds pretty good, I’m just going to have to get straight, where exactly to place <?php the_content();?>.
Would I put this code into the actual post
What does the relevant theme template currently use?
Would I put this code into the actual post,
No – it’s strictly a template tag.
right, okay.. so this is a part where maybe you can school me. So I’d be going to Appearance>Editor in the WP Dash and inserting this tag into one of the available php templates that make up the theme.
These are what is available for options. Which template would I typically put a tag like this?:
Archives Page Template
Image Attachment Template
Links Page Template
Main Index Template
Page Comment Page Template
oh yeah… and does it matter where in the template? Can I just add it within the php code that already exists, maybe at the end of it?
Which template would I typically put a tag like this?
Which page do you want this to appear in? You can find a generic list of what template is used in which page on the Codex’s Theme_Development page.
awesome, I will refer to that resource. Thanks man, you’ve been quite a help, I know my needs have been somewhat basic.. but I guess that’s what makes the WP Forums great! When I get this implemented successfully, I will let you know 🙂
okay, so upon doing that research I’ve determined that I have to add <?php the_content();?> within the “the loop” on the main index template: index.php. I’m wondering where to add it within the loop.
Do I need to pass any parameters, or will just adding this tag add that extra functionality to the “more” tag that I am looking for concerning these image thumbs.
After I get this figured out I will probably be adding at least one parameter to this tag in order to change the post excerpt display text of “more” to “read more”.
- The topic ‘Controlling Image display in post excerpts’ is closed to new replies.