Tagged: x
-
AuthorPosts
-
September 8, 2016 at 7:42 am #1166312
pcnordhaugParticipantHi there!
I have before customized the Read More tekst. Made it a button and changed the text to my language. Found this code in here and worked out perfect;
// Remove the ... from excerpt and change the text function x_excerpt_string( $more ) { $stack = x_get_stack(); if ( $stack == 'integrity' ) { return ' ... <div><a href="' . get_permalink() . '" class="more-link">' . __( 'Les mer →', '__x__' ) . '</a></div>'; } else if ( $stack == 'renew' ) { return ' ... <a href="' . get_permalink() . '" class="more-link">' . __( 'Les mer →', '__x__' ) . '</a>'; } else if ( $stack == 'icon' ) { return ' ...'; } } add_filter( 'excerpt_more', 'x_excerpt_string' );I now tried to add some custome text to the excerpt an them this button disappeared.
Found this code in here to fix this;
// Adding Excerpt to Posts function excerpt_read_more_link($output) { global $post; return $output . '<a href="'. get_permalink($post->ID) . '"> Read More</a>'; } add_filter('the_excerpt', 'excerpt_read_more_link');The only thing this did was to put a “Read more” on the bottom.
I would like to have the same botton here too. But how?
September 8, 2016 at 7:45 am #1166321
pcnordhaugParticipantThis reply has been marked as private.September 8, 2016 at 11:39 am #1166644
JadeModeratorHi there,
Please try this code:
// Adding Excerpt to Posts function excerpt_read_more_link($output) { global $post; return $output . '<a href="'. get_permalink($post->ID) . '" class="more-link"> Read More</a>'; } add_filter('the_excerpt', 'excerpt_read_more_link');Hope this helps.
September 9, 2016 at 1:23 am #1167585
pcnordhaugParticipantThanx – that helped! Only problem now is that if i dont want to hace custome excerpts on some posts the Read More Button comes in twice. Is there a way to solve this?
September 9, 2016 at 3:35 am #1167712
Paul RModeratorHi,
Please remove the code in your functions.php and add your read more link together with your custom excerpt.
September 12, 2016 at 12:35 am #1170788
pcnordhaugParticipantSweet! Thanx a lot! 🙂
September 12, 2016 at 12:58 am #1170814
Rue NelModeratorYou’re welcome!
Thanks for letting us know that it has worked for you.October 3, 2016 at 1:06 am #1200105
pcnordhaugParticipantThis issue above was solved with this code in functions.php
function excerpt_read_more_link($output) { global $post; return $output . '<a href="'. get_permalink($post->ID) . '" class="more-link"> Les mer →</a>'; } add_filter('the_excerpt', 'excerpt_read_more_link');There is no “read-more-link” placed together with the custom excerpt. Just the text.
This workes great. But if you do a search for a word both the blog posts and portfolio post appear. The blog posts works with just one “read-more”-button because of the code obove – but not the portfolio post. They still have two of them. Is there a way to remove one of them with a similar code?
October 3, 2016 at 1:13 am #1200117
ChristopherModeratorHi there,
All pages except home page shows under construction page.
Please check.Thanks.
October 13, 2016 at 5:22 pm #1215324
pcnordhaugParticipantThis reply has been marked as private.October 13, 2016 at 11:11 pm #1215677
RupokMemberHi there,
So this problem is for the search result page only? In that case you can add this under Custom > CSS in the Customizer.
.search-results .excerpt div > .more-link { display: none; }Hope this helps.
October 14, 2016 at 6:00 am #1216005
pcnordhaugParticipantWorks on the dektop. Not from a mobile device. Is there a code to add for that?
October 14, 2016 at 3:55 pm #1216619
RadModeratorHi there,
Please change it to this,
// Adding Excerpt to Posts function excerpt_read_more_link( $output ) { global $post; return !empty( $post->post_excerpt ) ? $output . '<a href="'. get_permalink($post->ID) . '" class="more-link"> Read More</a>' : $output ; } add_filter('the_excerpt', 'excerpt_read_more_link');That code will check if post excerpt is not empty, and it will add read more only if it’s not empty. That excerpt is the one you manually added.
Thanks!
October 17, 2016 at 1:59 am #1219007
pcnordhaugParticipantThis is into the function file istead right 😉
But anyway – don´t work. The hole page goes blank if pasted in…
October 17, 2016 at 2:09 am #1219013
Paul RModeratorHi,
Please note that you need to change the previously added code with the function name excerpt_read_more_link
With this
// Adding Excerpt to Posts function excerpt_read_more_link( $output ) { global $post; return !empty( $post->post_excerpt ) ? $output . '<a href="'. get_permalink($post->ID) . '" class="more-link"> Read More</a>' : $output ; } add_filter('the_excerpt', 'excerpt_read_more_link');If that does not help, please provide wordpress admin login in private reply.
Thanks
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1166312 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
