How To Exclude Images In Summaries | WordPress Tweak

Posted by in Articles, Internet

I was stunned by Google today, because I didn’t get what I wanted from Google search. While designing a WordPress template I suddenly noticed that my summary post at WordPress home page considers image when I margin more tag below image. But I didn’t wished it to be like this.

Images in summary are be very unattractive and ugly looking. It can even dismantle or dis-layout your webpage.

While posting, what you usually do is add more tag:

When you add margin, everything above more tag the including image just above it also will be visible:

You may want somewhat similar features like this blog, as you can see that we don’t have irregular image in our main page.

Now let me teach you how to do this in your template. To do this you must have basic knowledge in html and must have little experience in html programming. But actually we are not doing any coding here, we’ll be just copying some code and replacing it with older one.

Usually most of the WordPress template uses following code snippet to load post summary in index page.

Actually WordPress by default has availed this feature to you. But this excerpt will not be visible until you replace the above code snippet with another one.

WordPress Excerpt is an optional summary or description of a post; in short, a post summary. The part of a post that appears on the front page when you use the More tag is called teaser. If you have post images showing up in your main excerpt page, then you must know that it’s using teaser rather than excerpt.

Now, how to replace teaser with excerpt.

You can easily accomplish this by following the method I guide you through.

In your WordPress Admin page, navigate to Appearance > Editor.

At the right side of the page, click on Main Index Template.

Now in the code editor, search for following code snippet:

<?php the_content(); ?>

Now replace the_content with the_excerpt.

<?php the_content();?> must be replaced to <?php the_excerpt();?>.

Now update the page.

Now whenever you type anything on excerpt page, it will be posted as summary of the post and will appear on the main page.

Even if you don’t type anything in excerpt, the main page will automatically load first 50 words excluding image.

Hope this was helpful.