Jetpack Functions
-
I’m trying to make it so that Jetpack related posts only display on the AMP endpoint pages of my site, and output a certain number of posts. Is there an easy way to make the functions listed below play nice together and code them into my current child theme’s functions?
I would prefer to keep using the Legacy AMP theme if at all possible, in Reader mode.
function jetpackme_remove_rp() { if ( class_exists( 'Jetpack_RelatedPosts' ) ) { $jprp = Jetpack_RelatedPosts::init(); $callback = array( $jprp, 'filter_add_target_to_dom' ); remove_filter( 'the_content', $callback, 40 ); } } add_action( 'wp', 'jetpackme_remove_rp', 20 ); if( function_exists('amp_is_request') && is_amp_endpoint() ) { function jetpackme_more_related_posts( $options ) { $options['size'] = 6; return $options; } add_filter( 'jetpack_relatedposts_filter_options', 'jetpackme_more_related_posts' ); }
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Jetpack Functions’ is closed to new replies.