Never Use The <!–More–> Tag Again!

no-more-tags

In past, I used to be showing all of my content in the front page, which irritated new users and readers who had low bandwidth. As a blogger, I want to reach more and more people and by keeping this in mind, I have to keep my FrontPage from slowing down with all the images I use in my posts. At first, I started using the_excerpt instead of the_content but that nonsense [...] thing panic me. Then I began searching for a better alternative and came across the traditional <!–more–> tag. No doubt, It is a popular way to customize excerpt and most of the bloggers and content writers use it but again, as I have found out myself a bit lazy :D, I don’t want to enter that <!–more–> tag in all of my posts manually and want to get excerpts of all posts in one go {as what they say..dynamically ;) }. After searching a lot, I came around a far better alternative to the <!–more–> tag which is a Plugin named the_excerpt_reloaded. This Plugin is made just for a lazy person like me…and can make all your posts into excerpts in a snap.

Here is how to use the Plugin:

Download the Plugin, extract, then upload to yourblog.com/wp-content/plugins/ folder. Activate it and get ready to configure the Plugin according to your needs.

Here is the Plugin format:

<?php the_excerpt_reloaded(excerpt_length, ‘allowedtags’, ‘filter_type’, use_more_link, ‘more_link_text’, force_more_link, fakeit, fix_tags); ?>

First, go to your index.php file and replace <?php the_content(); ?> with <?php the_excerpt_reloaded(); ?> in such a way that it must be in The Loop. Then use the parameter from anyone of the above. Don’t hesitate with all the code jargon as I am going to explain all the parameters one by one.

1-excerpt_length

Set the number of words {you want to see in an excerpt} here. Default is 120.

2-allowedtags

Include the tags you want to see in an excerpt. For example, if you want to see links and images in an excerpt use <?php the_excerpt_reloaded(’<a><img>’); ?>.

3-filter_type

Tell WordPress how to format content. You can specify ‘content’, ‘content_rss’, ‘excerpt’, ‘excerpt_rss’. Set to ‘none’ to format raw content. Default is ‘excerpt’ .

4-use_more_link

Tell the Plugin if it should display [...] or (more…) link. Default is TRUE which will display (more…) link. Set it to FALSE to display [...]. Remember the link will display only if output is more than excerpt_length you provided in step 1.

5-more_link_text

If use_more_link is enabled, then specify which text to show. Default is ‘(more…)’.

6-force_more_link

As I wrote in step no. 4, If the output is less than excerpt_length, more link will not display. But you can force it to display by putting force_more_link to TRUE. Default is FALSE.

7-fakeit

Set it to 1 to display Excerpt even if you have not provided Excerpt under Advanced Options in WordPress Text Editor or set to 0 to display only the excerpts you have provided in text editor options. Or set to 2 to display content as excerpts always.

8-fix_tags

If any HTML tag breaks by setting the excerpt_length. Set fix_tags to TRUE to fix it. Or set to FALSE if you want the HTML tags as it is.

Look at this:

<?php the_excerpt_reloaded(80, ‘<a><img>’, ‘excerpt’, TRUE, ‘Click here to read more’, FALSE, 2, TRUE); ?>

Output:

a-Displays 80 words in an excerpt

b-Includes links and images if they come under the excerpt

c-Format the content as excerpt

d-Displays the (more…) link

e-Displays (more…) link as Click here to read more

f-Do not display more link if excerpt is less then the given length

g-Displays content as excerpt always

h-Repair HTML tags if broken due to excerpt_length

You can even do the custom CSS styling to the more link. Simply wrap <?php the_excerpt_reloaded(); ?> under div tag and do the styling as you want!

With so many flexibility, options and dynamic features of this Plugin, I am not going to use the <!–more–> tag anymore. Are you?

Viewing 3 Comments

 

Trackbacks

(Trackback URL)

close Reblog this comment
blog comments powered by Disqus