Archived topic
Post excerpt not cohesive between blog posts
7 replies · Started by Bjørnar on June 6, 2020
Hi,
I have a site where I post music for download, and license. Using Generatepress and loving it! Great theme.
I have made a child theme, and added the following code to functions.php get it to show shortcodes and HTML in the excerpt. The front page should only show a little card, or excerpt if you will...
//Enable Shortcodes in WordPress Excerpts and Text Widgets. Add to functions.php
add_filter( 'get_the_excerpt', 'my_shortcode_parser' );
function my_shortcode_parser( $excerpt ) {
return do_shortcode($excerpt);
}
So in the excerpt I want to have an audio player, button to the purchase page on sellfy, and a download MP3 button. This works on most of the blog posts. But on some, the link to sellfy is not visible. But if I inspect the code, I think its there. The audio player also looks different on some posts.
Probably me doing something wrong... but any suggestion on what to check why certain elements doesnt show up?
I have disabled caching, etc.
Hi there,
I'm not sure unfortunately.
So you are using the custom excerpt metabox and adding shortcode to all of them?
Yes I use the custom excerpt box. I add both shortcodes, and HTML codes to sites like sellfy etc.
Under the "Element 115" Excerpt I have added this code. In the excerpt box.
<a href="https://sellfy.com/p/tq9pti/" id="tq9pti" class="sellfy-buy-button" data-text="Pro License From"></a>
<script src="https://sellfy.com/js/api_buttons.js"></script>
But it doesnt show the button (that code should generate) on the excerpt. But this code does work on the other excerpts before Element 115.
Seems like disabling "Infinite Scroll" fixed the issue.
Hi there,
looks like your script is only firing on an initial load - so it doesn't load on elements that are Ajax Loaded like infinite scroll does.
I am not sure how to fix that - aside from not using Load More / Infinite scroll options.
The important part is that we found out why the issue was happining. Now onto google to search for some coding tips.
Cheers. :)
Glad to be of help