Art IMHO homepage

art in my humble opinion

  • VisualArt
  • Photography
  • Philosophy
  • Css and XHTML
  • Marketing
  • Cooking

WP - Change excerpt length in Wordpress

0 COMMENTS
code, coding, how to, PHP, Wordpress, WP
CSS & xHTML
March 17th,2010


There is more than one way to change the excerpt length in a Wordpress Post.
I collected all the working methods to change the default excerpt (55) to however you need.

wp_tutorial

Solution 1 - Excerpt length in “wp-includes”

PROS: Fast and easy.
CONS: This will be applied to every category and archive, incluiding the blog homepage.
Source: It’s Called Web Design

Go into “wp-includes/formatting.php”, line 1333 (line 853 for version prior to 2.7).
Change “55″ according to your needs.

Solution 2 - Excerpt length using Filters in “functions.php”

PROS: You can freely change the excerpt length in each category, archive or in your blog homepage.
CONS: A basic skill in WP and PHP is required.
Source: Wordpress Codex

STEP 1. You can change the excerpt length using excerpt_length filter. Just add the following code into the “wp-content/themes/THEME_NAME/functions.php” file:
<?php
function new_excerpt_length($length) {
return 20;
}
add_filter('excerpt_length', 'new_excerpt_length');
?>

STEP 2. Add the following code into the entry/post div (”index.php“, “archive.php“)
<?php the_content_limit(200, "Read more →") ?>instead of
<?php the_content(); ?>You can write whatever you want insted of “200″ and “Read more →”. Eg. (120, “Want to know more about it?”).

Solution 3 - Excerpt length using the “Excerpt Plugin”

PROS: Easy to use.
CONS: A basic skill in WP and PHP is required.
Source: Download from guff.szub.net

Set the excerpt length using the Excerpt Reloaded plugin. Simple theme editing is required.

Parameters:

  • excerpt_length (integer) - Number of words to display. Default is 120.
  • allowedtags (string) - Defines HTML tags. Default is ‘<a>’.
  • filter_type (string) - Defines how WP should filter the content. Options are based on tags: ‘content’, ‘content_rss’, ‘excerpt’, ‘excerpt_rss’. Set to ‘none’ to display raw content. Default is ‘excerpt’.
  • use_more_link (boolean) - Display the “more” link (TRUE) or (FALSE). Defaults to TRUE.
  • more_link_text (string) - Define the text used for the link. Default is ‘(more…)’.
  • Other functions: force_more_link (boolean) - fakeit (integer) - fix_tags (boolean).

Happy coding! :)

Share it!
Add 'WP - Change excerpt length in Wordpress' to Del.icio.usAdd 'WP - Change excerpt length in Wordpress' to diggAdd 'WP - Change excerpt length in Wordpress' to redditAdd 'WP - Change excerpt length in Wordpress' to TechnoratiAdd 'WP - Change excerpt length in Wordpress' to Google BookmarksAdd 'WP - Change excerpt length in Wordpress' to FaceBookAdd 'WP - Change excerpt length in Wordpress' to WikioAdd 'WP - Change excerpt length in Wordpress' to Twitter

If you enjoyed reading this article, please check out other related articles below:

  • Tribute to Michael Jackson. It Don’t Matter If You’re Black Or White.
  • Cooking is Art: creativity between food and technology.
  • The Golden Ratio: in harmony with the Universe
  • Mmmmhh.. delicious! Nerds are hungry night and day…
  • Tribute to Caravaggio - Bacco revisited


Comments »

No comments yet.

Click here to cancel "reply".
Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.
FOLLOW ME TwitterCounter for @BlackMamby
RSS | E-MAIL

Author

Welcome in my way of being! A "geeky" way to see the fine art that sorrounds us, but not everybody are able to see. I'm Mirta, Art Director of Symbiotic Sas, in Rome. This blog represents me and I hope you will enojoy its content. Suggestions are welcome! More about me...

How to contact me? Easy! E-MAIL ME! Or meet-up @ 41.91 - 12.46 from 15:00 to 21:00 CET :D

Categories

  • Cooking
  • CSS & xHTML
  • Marketing
  • Philosophy
  • Photography
  • VisualArt

<art>IMHO</art>

art in my humble opinion

Copyright © 2010 Mirta Rotondo. All right reserved. Symbiotic Web agency - Roma

<art>IMHO</art> | CSS and XHTML validation | Entries RSS and Comments RSS