Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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

Posted on 2011-10-19
Medium Priority
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
  • 2
  • 2
LVL 70

Accepted Solution

Jason C. Levine earned 2000 total points
ID: 36994005
>> 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

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

Expert Comment

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

Expert Comment

ID: 37072664
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

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

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I want to start by talking about the use of plug-ins for WordPress. I started a web-site for a company I was working for a few years ago; I had extremely basic knowledge of HTML. I am a Graphic Designer by trade so I invited the opportunity as a cha…
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
Suggested Courses

572 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