Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Kry8ter on "Excluding by Tag String, Register by Function?"

$
0
0

I have 3 loops running on the front page.

One for the slider, and it wants posts that have the tag "slider".

One for featured articles, and it wants posts that have the tag "featured".

And a third I am calling in loop_latest.php, it wants the 6 latest posts; the trick here is those need to be the 6 latests that do NOT have the tags "slider" or "featured".

So I have this query.

$query = new WP_Query(
     array(
              'showposts' => '6',
              'tag_not_in' => array('featured, slider'),
     ) );

I'm pretty sure the problem here is that "tag_not_in" doesn't like strings, it wants IDs.

SO! Is there a way to pass it the strings?

If not, how do I divine what the IDs of tags are?

Can I run some code in "functions.php" to set and reserve the ids? featured == 777, slider == 888
Something like that?

I'd like to be able to SET them so that gets packaged with this theme. Rather than have to hope that when the client registers the tags "slider" and "featured" they match up with what I have chosen in the loops/query.

Thanks for your help, my google-fu isn't working out on this one.


Viewing all articles
Browse latest Browse all 8245

Trending Articles