WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to check whether a post exceeds 300 words or not. If it exceeds 300 words, then I have to provide a link to read more about the post.How can I do it? Please help me.I am new to word press.

share|improve this question
up vote 0 down vote accepted

basically you need to change the default EXCERPT length of your posts.

there are a couple of ways to solve this issue:

  1. if you aren't familiar with PHP

Install this plugin at : http://wordpress.org/plugins/advanced-excerpt/

This will allow you to change the the excerpt length from the admin panel.

  1. if you are familiar with basic PHP

Go to your functions.php in your theme at /wp-content/themes/YOUR_THEME_NAME/functions.php

Add the following code:

function different_excerpt_length($length) {
    return 200;
add_filter('excerpt_length', 'different_excerpt_length');

You can change 200 to any number you want like 300.

As for showing your summary instead of the full post, you can follow the instructions from wordpress.com like so : http://en.support.wordpress.com/splitting-content/more-tag/

Hope it helps!

share|improve this answer
Thank you for your reply. How can I also add the 'read more' link,so that when I click on that link, I can view the full post – user1991 Oct 16 '13 at 5:24
Hi i edited the post. You can try this post out: en.support.wordpress.com/splitting-content/more-tag – Aaron Lee Oct 16 '13 at 5:30
where should I call this function? – user1991 Oct 16 '13 at 5:31
if you are referring to different_excerpt_length(), when you add_filter, the function is called when WordPress runs your theme. So that should work. Do make sure you add it to your ACTIVE theme :) – Aaron Lee Oct 16 '13 at 5:33
sorry, I can't follow you. I AM NOT UNDERSTANDING THE METHOD YOU ADOPT. can you please be clear. Actually I need to display only the first 300 word of each post in my home page. And under each post I need a read more link.so that when I click on that link I need to view the full post – user1991 Oct 16 '13 at 5:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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