Tagged: x
-
AuthorPosts
-
November 11, 2016 at 6:07 pm #1253883
RadModeratorHi there,
The “read more” is only applicable for excerpt generated by WordPress, and not for excerpt manually added. Example, this text is added to your post’s excerpt in admin.
This is Alina Tanasa’s watercolor fashion illustration, painted by Madalina Zlamparet. Alina Tanasa is the co-founder of fabulousmuses.net.
If you wish to add “read more” to manually added text, then please add this code to your child theme’s functions.php
add_filter('the_excerpt', 'manual_excerpt_read_more', 9999); function manual_excerpt_read_more ( $excerpt ) { global $post; return empty( $post->post_excerpt ) ? $excerpt : sprintf( '<a class="read-more" href="%1$s">%2$s</a>', get_permalink( get_the_ID() ), __( 'Read More', '__x__ ) ); }Hope this helps.
November 12, 2016 at 5:10 am #1254306
AndreiParticipantHi Rad,
Thank you for your reply.
I tried to add this code and I get this error:
Parse error: syntax error, unexpected ”__x__ ) ); ‘ (T_ENCAPSED_AND_WHITESPACE) in /home/forexc9/public_html/sinestezic.com/wp-content/themes/x-child/functions.php on line 259November 12, 2016 at 5:22 am #1254317
ChristopherModeratorHi there,
Please update your code to :
add_filter('the_excerpt', 'manual_excerpt_read_more', 9999); function manual_excerpt_read_more ( $excerpt ) { global $post; return empty( $post->post_excerpt ) ? $excerpt : sprintf( '<a class="read-more" href="%1$s">%2$s</a>', get_permalink( get_the_ID() ), __( 'Read More', '__x__') ); }Hope it helps.
November 14, 2016 at 3:45 am #1256105
AndreiParticipantHi Christopher,
Now I can’t see the excerpt.
November 14, 2016 at 5:32 am #1256221
Paul RModeratorHi,
Please change the code to this.
add_filter('the_excerpt', 'manual_excerpt_read_more', 9999); function manual_excerpt_read_more ( $excerpt ) { global $post; if( empty( $post->post_excerpt )) { echo $excerpt; } else { echo sprintf( '<p>%1$s</p><a class="read-more" href="%2$s">%3$s</a>', $post->post_excerpt,get_permalink( get_the_ID() ), __( 'Read More', '__x__') ); } }Thanks
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1250766 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
