Skip to content

Instantly share code, notes, and snippets.

@RCowles
Last active September 16, 2018 05:43
Show Gist options
  • Save RCowles/f53118fa11da23301b5c to your computer and use it in GitHub Desktop.
Save RCowles/f53118fa11da23301b5c to your computer and use it in GitHub Desktop.
Move Jetpack's Related Posts
<?php
// Let's unhook the original filter
function jetpackme_remove_rp() {
$jprp = Jetpack_RelatedPosts::init();
$callback = array( $jprp, 'filter_add_target_to_dom' );
remove_filter( 'the_content', $callback, 40 );
}
add_filter( 'wp', 'jetpackme_remove_rp', 20 );
<?php
// Let's add the Related Posts shortcode to our template
do_shortcode( '[jetpack-related-posts]');
@andreafalzetti
Copy link

Thanks for sharing. Now it works doing:

single.php

echo do_shortcode( '[jetpack-related-posts]');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment