HomeWHICHWhich Idea Does This Excerpt Support

Which Idea Does This Excerpt Support

Thank you @macmanx for your reply.

Actually I don’t like more-block, just because is a writer site/blog, you know, I want to create curiosity by writing a little summary or synopsis of the article, without necessarily reporting the first bit of it.

Do you know a way to “substitute” from normal behavior to “excerpt mode”? I mean, I’m trying to modify the code and I found excerpt hook filter in functions.php

function toujours_excerpt_length( $length ) { return 35; } add_filter( ‘excerpt_length’, ‘toujours_excerpt_length’, 999 ); /** * Replaces the excerpt “more” text by a link */ if ( ! function_exists( ‘toujours_excerpt_continue_reading’ ) ) { function toujours_excerpt_continue_reading() { return ‘&hellip; <a href=”‘ . esc_url( get_permalink() ) . ‘”>’ . sprintf( esc_html__( ‘More’, ‘toujours’ ), ‘<span class=”screen-reader-text”> “‘ . get_the_title() . ‘”</span>’ ) . ‘</a>’; } } add_filter( ‘excerpt_more’, ‘toujours_excerpt_continue_reading’ );

Now, I’m pretty sure that the part that I need to modify is inside content.php file in template-parts folder, so I see this

<?php if ( ” !== $post->post_content ) { ?> <div class=”entry-content”> <?php the_content( sprintf( /* translators: %s: Name of current post. */ wp_kses( __( ‘Continue reading %s <span class=”meta-nav”>&rarr;</span>’, ‘toujours’ ), array( ‘span’ => array( ‘class’ => array() ) ) ), the_title( ‘<span class=”screen-reader-text”>”‘, ‘”</span>’, false ) ) ); ?> <?php wp_link_pages( array( ‘before’ => ‘<div class=”page-links”><span class=”page-links-title”>’ . esc_html__( ‘Pages:’, ‘toujours’ ) . ‘</span>’, ‘after’ => ‘</div>’, ‘pagelink’ => ‘<span class=”page-links-num”>%</span>’ ) ); ?> </div><!- .entry-content -> <?php } ?>

Refer to more articles:  Which Home Improvement Kid Died

and if I remove this part

<?php the_content( sprintf( /* translators: %s: Name of current post. */ wp_kses( __( ‘Continue reading %s <span class=”meta-nav”>&rarr;</span>’, ‘toujours’ ), array( ‘span’ => array( ‘class’ => array() ) ) ), the_title( ‘<span class=”screen-reader-text”>”‘, ‘”</span>’, false ) ) ); ?>

No article content is showed, for this I think is the right section, but I can’t understand why the excerpt is not showed, I mean, I set it up inside the article post but is not even showed, but if I install a plug-in “Advanced Excerpt” and I set to make an excerpt after 20 chars (space included) nothing happen, but if I set this option on “Generate excerpts even if a post has a custom excerpt attached.” then every post is trimmed after 20 chars and is correct. So this tell me that Toujours theme use the article content like an excerpt, or this’s what I think. I don’t know if I have explained myself well. And I also noticed that featured content are reported with the correct excerpt, so like you said, every template have a different way to show excerpt. I searched a bit and featured content by jetpack that call some “post” function and report an “array”, but I’m not an expert on WordPress, so I need some help, and I’ve to ask For these reasons I think that $post->post_content is doing the “bad job”, also because the “Advanced Excerpt” plug-in automatically hooks on the_excerpt() and the_content() but I need to force it in order to use it.

So, let assume that a theme don’t have excerpt support, how can I add this?

Refer to more articles:  Which Is The Recommended Water Skiing Safety Practice

Any idea?

J

Previous article
Next article
RELATED ARTICLES

Most Popular

Recent Comments