WordPress.org

Ready to get started?Download WordPress

Forums

WordPress Bones theme, changing default Excerpt amount of words (2 posts)

  1. sixfootjames
    Member
    Posted 7 months ago #

    Been back and forth with this one and cannot find anything on the Themble site about this. I am trying to shorten the length of the_Excerpt from 55 words to 20. Have checked the codex and know what I need to do and tried implementing several options to no avail. Upon doing a folder search for "excerpt" I came across this in the bones.php file

    // This removes the annoying […] to a Read More link
         function bones_excerpt_more($more) {
    	 global $post;
    	 // edit here if you like
    	 return '...  <a class="excerpt-read-more" href="'. get_permalink($post->ID) . '"
             title="'. __( 'Read', 'bonestheme' ) . get_the_title($post->ID).'">'. __( 'Read
             more »', 'bonestheme' ) .'</a>';
         }

    with a call earlier up the in the page to

    // cleaning up excerpt
         add_filter( 'excerpt_more', 'bones_excerpt_more' );

    In the bones_excerpt_more function I have tried adding some random text to see if it will output the text which it didn't. Tried removing all of the content of this function and it made no difference either which tells me this is not even being called.

    Originally in my functions.php file I had this from the Codex.

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

    I tried changing the priority but nothing's happening there either so I am at a loss and cannot find any more documentation in the bones theme even though it is very well documented in my opinion.

    Many thanks.

  2. bravokeyl
    Member
    Posted 7 months ago #

    Are you using manual excerpts(user-defined) ?

Reply

You must log in to post.

About this Topic