Created
December 15, 2017 11:20
-
-
Save zartgesotten/e8403becfae034b6da71919a40680d89 to your computer and use it in GitHub Desktop.
You might want to display "related" posts via Themer and a grid or other content module. Too bad, they also display the current Post. This code goes into functions.php and removes the current post from the loop on single pages.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'fl_builder_loop_query_args', 'probb_exclude_current_post' ); | |
function probb_exclude_current_post( $args ) | |
{ | |
//add post type here | |
if( is_singular( 'referenz' ) ) | |
{ | |
$args['post__not_in'] = array( get_the_ID() ); | |
} | |
return $args; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment