WordPress.org

Ready to get started?Download WordPress

Forums

Pinboard
WordPress Excerpt Override? (8 posts)

  1. ghundermark
    Member
    Posted 1 year ago #

    Hi All -

    I am trying to utilize WP's "Insert More Tag" while in TinyMCE, but it appears as if Pinboard has its own plans for the excerpt system. Does anyone have any suggestions/modifications for how I would deactivate Pinboard's system so that I could revert to WP's system? I like to use the "Insert More Tag" after my first paragraph of text, as opposed to X amount of characters/words.

    I already searched through the 12 pages of posts here and I didn't see any documentation on this.

    Thanks!
    - Greg

  2. akinom77
    Member
    Posted 1 year ago #

    Hi,

    Add this to the end of your functions.php file and then use the more tag in your post.

    function new_excerpt_more( $more ) {
    return '[.....]';
    }
    add_filter('excerpt_more', 'new_excerpt_more');

    Here is more on this: http://codex.wordpress.org/Template_Tags/the_excerpt

    Good luck.

  3. akinom77
    Member
    Posted 1 year ago #

    Btw, if you paragraph is longer than the 55 words (per the themes default) you also need to use this code in the same file and change the 20 to more words, what ever you need.

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

  4. ghundermark
    Member
    Posted 1 year ago #

    Hi akinom777,

    Thanks for your help. I'm a bit confused about your second post though - i.e. Why do I need to specify how many characters I want the more tag to kick in with? Isn't that why the more tag exists? Aren't I supposed to be able to insert that at any point I want?

  5. akinom77
    Member
    Posted 1 year ago #

    I think it's because this code doesn't override the theme's defined 55 words max.

    So as an example:

    The default is 55 words.
    You define your paragraph which let's say will be 70 words.
    - because of the theme's default of 55 words, it will cut off there and ignore your more tag because it's later. So if you increase the number of words, so it's always more than your paragraph, your more tag will be effective.

    At least that is what I saw happening.

  6. ghundermark
    Member
    Posted 1 year ago #

    Hi akinom77,

    What you suggested seemed to take no effect. As I glance through functions.php, Pinboard appears to have some of its own excerpt coding. I pasted it below. Any idea what to do now?

    if ( ! function_exists( 'pinboard_excerpt_length' ) ) :
    /**
     * Change the number of words shown in excerps
     *
     * @since Pinboard 1.0
     */
    function pinboard_excerpt_length( $length ) {
    	if( pinboard_is_teaser() ) {
    		if( has_post_format( 'aside' ) )
    			return 36;
    		else
    			return 22;
    	} else
    		return 50;
    }
    endif;
    
    add_filter( 'excerpt_length', 'pinboard_excerpt_length' );
    
    if ( ! function_exists( 'pinboard_excerpt_more' ) ) :
    /**
     * Changes the default excerpt trailing content
     *
     * Replaces the default [...] trailing text from excerpts
     * to a more pleasant ...
     *
     * @since Pinboard 1.0
     */
    function pinboard_excerpt_more($more) {
    	return ' …';
    }
    endif;
    
    add_filter( 'excerpt_more', 'pinboard_excerpt_more' );
    
    if ( ! function_exists( 'pinboard_password_form' ) ) :
    /**
     * Add password form on protected posts
     *
     * @since Pinboard 1.0.1
     */
    function pinboard_password_form( $excerpt ) {
    	if( post_password_required() )
    		$excerpt = apply_filters( 'the_content', get_the_content() );
    	return $excerpt;
    }
    endif;
  7. ghundermark
    Member
    Posted 1 year ago #

    OK, after reading this post, I think I figured it out. For anyone else who wants to accomplish the same thing as me, you'll need to go into all files called content-*.php and replace

    <?php the_excerpt(); ?>

    with

    <?php the_content(); ?>

    That will cause all of your posts to show in full unless you use the "Insert More Tag".

    Good luck everyone!

  8. akinom77
    Member
    Posted 1 year ago #

    That would be indeed the case if you are looking to have the entire post displayed, which was not your original question. You wanted to use the more tag after your first paragraph.

    Also, I tried your method of showing all text but did not like how it displayed for the pages where posts are organised into multiple columns which then made them unappealingly long.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags

No tags yet.