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.
1 Answer
basically you need to change the default EXCERPT length of your posts.
there are a couple of ways to solve this issue:
- 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.
- 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!
-
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– user1991Commented Oct 16, 2013 at 5:24
-
Hi i edited the post. You can try this post out: en.support.wordpress.com/splitting-content/more-tag Commented Oct 16, 2013 at 5:30
-
-
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 :) Commented Oct 16, 2013 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– user1991Commented Oct 16, 2013 at 5:53