trim auto and manually excerpts
Displaying the manual and auto excerpt the same way with [...] at the end and Bootstrap .btn-default „read more“ link below
This commit is contained in:
parent
38f89401b9
commit
ec81dcebed
|
@ -24,10 +24,7 @@
|
|||
|
||||
<?php
|
||||
/* translators: %s: Name of current post */
|
||||
the_excerpt( sprintf(
|
||||
__( 'Continue reading %s <span class="meta-nav">→</span>', 'understrap' ),
|
||||
the_title( '<span class="screen-reader-text">"', '"</span>', false )
|
||||
) );
|
||||
the_excerpt( );
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
|
|
@ -85,10 +85,21 @@ add_filter('show_admin_bar', '__return_false');
|
|||
/**
|
||||
/* Adding the Read more link to excerpts
|
||||
*/
|
||||
function new_excerpt_more( $more ) {
|
||||
/*function new_excerpt_more( $more ) {
|
||||
return ' <p><a class="read-more btn btn-default" href="'. get_permalink( get_the_ID() ) . '">' . __('Read More', 'understrap') . '</a></p>';
|
||||
}
|
||||
add_filter( 'excerpt_more', 'new_excerpt_more' );
|
||||
add_filter( 'excerpt_more', 'new_excerpt_more' );*/
|
||||
/* Removes the ... from the excerpt read more link */
|
||||
function custom_excerpt_more( $more ) {
|
||||
return '';
|
||||
}
|
||||
add_filter( 'excerpt_more', 'custom_excerpt_more' );
|
||||
|
||||
/* Add support for Featured Images per Post */
|
||||
/* Adds a custom read more link to all excerpts, manually or automatically generated */
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
|
||||
function all_excerpts_get_more_link($post_excerpt) {
|
||||
|
||||
return $post_excerpt . ' [...]<p><a class="btn btn-default" href="'. get_permalink($post->ID) . '">' . 'Read More...' . '</a></p>';
|
||||
}
|
||||
add_filter('wp_trim_excerpt', 'all_excerpts_get_more_link');
|
||||
|
|
|
@ -28,6 +28,7 @@ get_header(); ?>
|
|||
<?php /* Start the Loop */ ?>
|
||||
|
||||
<?php while ( have_posts() ) : the_post(); ?>
|
||||
|
||||
<?php
|
||||
/* Include the Post-Format-specific template for the content.
|
||||
* If you want to override this in a child theme, then include a file
|
||||
|
@ -35,6 +36,7 @@ get_header(); ?>
|
|||
*/
|
||||
get_template_part( 'content', get_post_format() );
|
||||
?>
|
||||
|
||||
<?php endwhile; ?>
|
||||
|
||||
<?php understrap_paging_nav(); ?>
|
||||
|
|
Reference in New Issue