Excerpt functions is removing the forward slash on the url
Here is the fix: return $readmore ? $str . ‘<a class=”more-link” href=”‘. get_permalink($post->ID) . ‘”>’. __(‘read more’) .'</a>’ . ‘</a>’ : $str . ‘…’;
Here is the fix: return $readmore ? $str . ‘<a class=”more-link” href=”‘. get_permalink($post->ID) . ‘”>’. __(‘read more’) .'</a>’ . ‘</a>’ : $str . ‘…’;
If you are simply trying to echo the excerpt in a specific part of a theme, you can simply use the following code within the loop: <?php $excerpt = get_the_excerpt(); echo substr( $excerpt, 0, 15 ) . ‘…’; ?> If you want to filter the excerpt globally (in archives, blog pages, etcetera) to match any … Read more
get_the_excerpt adding unwanted links to output html
You’ll need to create a new loop – outside of your main loop – using get_posts() and passing the page ID for the ‘About’ page and setting post_type to page Then, inside your new loop simply call get_the_excerpt() Update: From my links: $args = array( ‘post_type’ => ‘page’ ); $myposts = get_posts( $args ); foreach … Read more
It seems you need to rest the post data before return the $postCount. Before return it, add the follow: wp_reset_postdata(); — There is a difference between wp_reset_query()and wp_reset_postdata(), as explained here. wp_reset_query() – ensure that the main query has been reset to the original main query. wp_reset_postdata() – ensures that the global $post has been … Read more
I found the following plugin that shows the results on many phrases of the same post: https://scott.yang.id.au/pages/search-excerpt.html
First of all return is used in PHP to return a value from a function. If you want to display something you need echo. Second, no excerpt is displayed in the lines you are pointing to. The excerpt is retrieved and then stored in a variable $myExcerpt. If you want to add … to the … Read more
Your question is not entirely clear, but it looks like you simply want to remove the continue reading button from the excerpt. You have already found the offending code. Nothing stops you from modifying it in this way: function new_excerpt_more($more) { global $post; return ”; } add_filter(‘excerpt_more’, ‘new_excerpt_more’); To do this properly you must not … Read more
You are possibly in a secondary loop within a page, in which case you would do well to pass the ID of the post excerpt that you’re trying to get. if ( get_the_excerpt($real_id_of_post_you_want_the_excerpt_for) ) { the_excerpt( $real_id_of_post_you_want_the_excerpt_for ); }
why don’t you use get_the_excerpt instead. That doesn’t have the paragraph marks. You can even use your own filters. something similar. <?php $my_excerpt = get_the_excerpt(); if ( ” != $my_excerpt ) { // Some string manipulation performed } echo $my_excerpt; // Outputs the processed value to the page ?> view more on the codex https://codex.wordpress.org/Function_Reference/get_the_excerpt … Read more