Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* == added by msolution == */
- function replace_catid_prev( $join , $in_same_cat, $excluded_categories)
- {
- // edit this accordingly to get previous post from this cat id.//
- // to add multiple cat ids add them seperating them with a comma ',' = '74, 75, 76'; //
- $cat_id = '74';
- if( ! empty( $join ) && $in_same_cat )
- return preg_replace('#tt.term_id IN \((.*?)\)#ism', 'tt.term_id IN ('.$cat_id.')', $join);
- else
- return;
- }
- function replace_catid_next( $join , $in_same_cat, $excluded_categories)
- {
- // edit this accordingly to get next post from this cat id.//
- $cat_id = '74';
- if( ! empty( $join ) && $in_same_cat )
- return preg_replace('#tt.term_id IN \((.*?)\)#ism', 'tt.term_id IN ('.$cat_id.')', $join);
- else
- return;
- }
- add_filter('get_previous_post_join', 'replace_catid_prev', 10, 3 );
- add_filter('get_next_post_join', 'replace_catid_next', 10, 3);
- /* == /added by msolution == */
Add Comment
Please, Sign In to add comment