1475 posts The right tools with none of the gimmicks
  • Sold between 50 000 and 100 000 dollars
  • Elite Author
  • Has been a member for 4-5 years
  • Referred between 50 and 99 users
  • Bought between 10 and 49 items
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • United States
+1 more
PixelBin says

Hi,

I have a Custom Query that displays 5 posts that have a certain meta value (featured posts). On the same page, I have a regular old Loop. I would like to exclude the posts displayed in the Custom Query from the Loop. Another problem is that the Custom Query and The Loop are in different functions in the functions.php file so variable values don’t carry over between the two.

Any help would be greatly appreciated!

629 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • United States
VagrantRadio says

Basically, you’re building a slider and you don’t want the posts in the slider also showing up in the loop?

629 posts
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • United States
VagrantRadio says
<?php query_posts(’showposts=8?); ?>

<?php while (have_posts()) : the_post();

if (array_search(get_the_ID(), $do_not_duplicate) !== false)

continue; update_post_caches($posts);
?>

CONTENT GOES HERE

<?php endwhile; ?>
1475 posts The right tools with none of the gimmicks
  • Sold between 50 000 and 100 000 dollars
  • Elite Author
  • Has been a member for 4-5 years
  • Referred between 50 and 99 users
  • Bought between 10 and 49 items
  • Contributed a Tutorial to a Tuts+ Site
  • Exclusive Author
  • United States
+1 more
PixelBin says

Hmm… I tried that but I’m not sure what you mean by the variable $do_not_duplicate because when I apply that code, it gives me an error stating variable needs to be an array.

by
by
by
by
by
by