WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Increase the number of words displayed on homepage post preview (4 posts)

  1. joshgarrod
    Member
    Posted 1 year ago #

    Hi everyone,

    My current theme displays my recent posts on my homepage with a sohrt preview of their content. I would like to increase the number of words the preview displays. Any ideas how I cold do this please:

    http:///www.how2caravan.com

    Thanks in advance,

    Josh

    [ Moderator note: It's this theme http://wordpress.org/extend/themes/infinity ]

  2. riversatile
    Member
    Posted 1 year ago #

    Hi,

    By default, excerpt length is set to 55 words. To change excerpt length using "excerpt_length" filter, add the following code to your theme's functions.php file :

    function custom_excerpt_length( $length ) {
    	return 20;
    }
    add_filter( 'excerpt_length', 'custom_excerpt_length', 100 );

    In this example, the value "100" will display excerpts limited by 100 words.

  3. Allen Moore
    Member
    Posted 1 year ago #

    Hey @joshgarrod. You may want to create a child theme and place the code provided by @riversatile in the functions.php file for that child theme. If you add it to the current functions.php file, you will lose that info if a theme update comes out and you update it.

    Here is some info on how to do this:
    http://codex.wordpress.org/Child_Themes

  4. joshgarrod
    Member
    Posted 1 year ago #

    Amazing, thanks very much for your help guys! Topic solved!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.