Replace one of the Related Posts by a custom result
-
I’m confused on where I would put the post ID in order to make this work. It could be a syntax thing, but I would appreciate if someone could actually show me an example using the ID’s below
My post ID is 11170
I would like to this post ID -> 11230 to appear in the related posts plugin.Where would I insert the two ID’s in the example below?
function jetpackme_append_related_post( $hits, $post_id ) {
// $post_id is the post we are currently getting related posts for
// Add 1036 to the front of the hits array
array_unshift( $hits, array( ‘id’ => 1036 ) );
return $hits;
}
add_filter( ‘jetpack_relatedposts_filter_hits’, ‘jetpackme_append_related_post’ );
- The topic ‘Replace one of the Related Posts by a custom result’ is closed to new replies.