New answers tagged exclude
0
The parameter you are looking for is post__not_in (kaiser has a typo in his answer). So the code could be like:
<?php
$my_query = new WP_Query(array(
'post__not_in' => array(278),
'post_type' => 'case-study',
'paged' => $paged,
));
while ($my_query->have_posts()) : $my_query->the_post();
?>
3
Don't use query_posts. Use a filter on pre_get_posts.
function no_front_sticky_wpse_98680($qry) {
if (is_front_page()) {
$qry->set('post__not_in',get_option( 'sticky_posts' ));
}
}
add_action('pre_get_posts','no_front_sticky_wpse_98680');
By running query_posts you clobber the main query, over-writing it with another query. That is why you ...
0
Please take a look at this example;
$args = array(
'post_type' => 'post',
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'movie_genre',
'field' => 'slug',
'terms' => array( 'action', 'comedy' )
),
array(
'taxonomy' => 'actor',
...
1
You have to declare $popular to be global before you use it. Based on the code you've posted you haven't done that.
global $popular;
$popular[] = 1 //post id=1
$popular[] = 2 //post id=2
$popular[] = 3 //post id=3
However, if you mean the index.php in the theme, that file is not always used. You may be defining the variable in a file that does not load ...
Top 50 recent answers are included