The “load more” script simply needs to fire the standard post-load event:
jQuery( document.body ).trigger( 'post-load' );
Within the script’s Ajax success function like:
misha_loadmore_params.current_page++;
jQuery( document.body ).trigger( 'post-load' );
Hi,
Thanks for the reply. Unfortunately this didn’t work. All the other things I have under my posts show up except for the add to any plugin. I have tried using the shortcode as well. Any other idea on how to fix this?
Thanks in advance
-
This reply was modified 8 years, 6 months ago by
plantman.
The above fix makes the shortcode buttons appear, but the standard buttons in posts are not included because the Load More script doesn’t invoke the main post query.
To include the standard buttons in those loaded posts, you can have AddToAny skip the is_main_query() check:
// Have AddToAny skip the is_main_query() check to
// show the standard buttons on Misha's Load More Posts.
function addtoany_misha_loadmore( $query ) {
// Remove to avoid the check.
remove_filter( 'the_content', 'A2A_SHARE_SAVE_add_to_content', 98 );
remove_filter( 'the_excerpt', 'A2A_SHARE_SAVE_add_to_content', 98 );
// Add without the check.
add_filter( 'the_content', 'A2A_SHARE_SAVE_add_to_content', 98 );
add_filter( 'the_excerpt', 'A2A_SHARE_SAVE_add_to_content', 98 );
}
add_action( 'pre_get_posts', 'addtoany_misha_loadmore' );
If you’re still stuck, provide a URL to your implementation so folks here can see what’s happening.