Skip to content

Instantly share code, notes, and snippets.

@palmiak

palmiak/wp.php Secret

Created May 31, 2017 22:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save palmiak/34389b42a33667de1a57194d21871fde to your computer and use it in GitHub Desktop.
Save palmiak/34389b42a33667de1a57194d21871fde to your computer and use it in GitHub Desktop.
<?php
// current post ID
$current_id = get_the_ID();
$inner_args = array(
p => $current_id
);
$inner_query = new WP_Query( $inner_args );
if ( $inner_query->have_posts() ) {
// your code
}
$inner_args = array(
'post_type' => 'post-type',
'posts_per_page' => -1,
'post__not_in => [ $current_id ]
);
$inner_query = new WP_Query( $inner_args );
if ( $inner_query->have_posts() ) {
// your code
}
//rest of your code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment