Post on Pages - Is it possible to show post previews with content limit on pages ?

Posted on 2011-10-19
Last Modified: 2012-05-12
I have a blog and on the home page i have a featured posts widget (set to display the latest post from any catagory) with a content limit of 300 characters. This widget also displays a thumnnail of the Featured image.

I would like to have the same Featured post to work on Pages.

To get Posts on Pages i have done the following ..

I have created a catagory called - Reviews (Catagory id is =5)
I then created a Page also Called - Reviews

On the Reviews page i selected the Template - Blog

In Custom Fields i used:

query_args       cat=5

This allows me to create a new post and select the catagory Reviews. The post appears on my homepage within featured posts widget and also appears on the Reviews Page.

My problem is that the entire post appears on the Reviews page. As you can imagine, after 3 or 4 posts the page gets very long.

I want to only display a preview of the post with featured image on the Review Page, the same as it does on the home page. Then if a visitor wants to see more of the posts they click on a 'Read More' link. That way i will be able to display more than just 3 or 4 long posts before they fall of the bottom of the page.

Thank you for your time.
Question by:rookeydooks
    LVL 70

    Accepted Solution

    >> My problem is that the entire post appears on the Reviews page.

    If you look at the code, it's retrieving the function the_content() which is everything in the post(s).  You either want to use the_excerpt() or use the <!--more--> tag in the posts so that it cuts off at the tag when presented in the loop.

    Author Comment

    Hi jason1178, which file has the code i need to look at ?
    LVL 70

    Expert Comment

    by:Jason C. Levine
    It would be your blog template file in the theme.
    LVL 31

    Expert Comment

    You could put this function your functions.php file


      function dooks_pageContentFilter($content)
        return substr($content, 0, 300);


    and then add


    if ( in_category( 'reviews' ) )
        add_filter( "the_content",  "dooks_pageContentFilter" );


    to your blog template file.
    LVL 31

    Expert Comment

    Using <!--more-->  in your original post, like jason said, is a simpler way to have the Read More link show.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    What's this? As a volunteer Page Editor for, I have noticed that many authors also have blogs, and pull articles from their blogs to post at Experts-Exchange. I appreciate each author sharing their blog content with our site …
    How to create your own WordPress Theme Before I begin with the theme design tutorial, I would like to give you the basics of what is required to make a WordPress Theme. The most basic WordPress theme only requires 2 files: a style.css file and an…
    The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
    The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now