Skip to content

Instantly share code, notes, and snippets.

@zartgesotten
Created December 15, 2017 11:20
Show Gist options
  • Save zartgesotten/e8403becfae034b6da71919a40680d89 to your computer and use it in GitHub Desktop.
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.
<?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