Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #260660
    Swatch
    Participant

    Hello,

    I’ve been trying to adjust the excerpt length on the homepage from 30 to lower but I seem to be struggling with the coding.

    	function bold_photography_excerpt_length( $length ) {
    		if ( is_admin() ) {
    			return $length;
    		}
    
    		// Getting data from Customizer Options
    		$length	= get_theme_mod( 'bold_photography_excerpt_length', 30 );
    
    		return absint( $length );
    	}
    endif; //bold_photography_excerpt_length
    add_filter( 'excerpt_length', 'bold_photography_excerpt_length', 999 );
    
    if ( ! function_exists( 'bold_photography_excerpt_more' ) ) :
    	/**
    	 * Replaces "[...]" (appended to automatically generated excerpts) with ... and a option from customizer
    	 *
    	 * @return string option from customizer prepended with an ellipsis.
    	 */
    	function bold_photography_excerpt_more( $more ) {
    		if ( is_admin() ) {
    			return $more;
    		}
    
    		$more_tag_text = get_theme_mod( 'bold_photography_excerpt_more_text',  esc_html__( 'Continue reading...', 'bold-photography' ) );
    
    		$link = sprintf( '<p class="more-link"><a href="%1$s" class="readmore">%2$s</a></p>',
    			esc_url( get_permalink() ),
    			/* translators: %s: Name of current post */
    			wp_kses_data( $more_tag_text ). '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>'
    			);
    
    		return $link;
    	}
    endif;

    I assume it is from the above part of the .php, but editing it to a lower number doesn’t seem to work for me. Nor do I know where specifically to add anything mentioned here, none work in customiser https://stackoverflow.com/questions/15294164/how-to-get-excerpt-text-to-automatically-cut-off-at-the-bottom-of-a-div

    I am looking for code which lowers it, or totally removes it.

    Thanks,

    Siren

    #260773
    Skandha
    Keymaster

    @swatch: Hello Siren,
    The option to change the excerpt length is in the customize.

    Go to => Appearance => Customize => Theme Options => Excerpt Options => Excerpt Length (words) => Change the number and Publish.

    Let me know if this solves your issues.
    Kind Regards,
    Skandha

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.