Hi
I wondered if anyone could help me regarding the loop. I'm displaying custom meta on posts and in the excerpt (see below). However there are some posts in particular categories where I dont want this to show. Can I put a conditional query at all in the loop?
Thankyou very much in advance
See loop below, the example page is
http://www.muddyrace.co.uk/south-east/warrior-adrenaline-race-bedfordshire/. The
[Code moderated as per the Forum Rules. Please use the pastebin]
great thanks, i thought so much.
There is only one or two categories where i dont want them to show on posts. Is there a way of using this conditional tag, but stating:
If in a certain category do NOT show rather than do show? As there's quie a few categories on the site?
Also where would this go in the following line of code?
<div class="meta"><b>Region: </b><?php $key="Region"; echo get_post_meta($post->ID, $key, true); ?></div>
try:
<?php if( !in_category('certain') ) { ?>
<div class="meta"><b>Region: </b><?php $key="Region"; echo get_post_meta($post->ID, $key, true); ?></div>
<?php } ?>
clear text: if NOT in_category then show 'region'
works a treat - thank you so much for your time.
one more thing if i wanted to exclude from 2 categories would it be just ('certain', 'certain1') for example?
thanks
for multiple categories, please fully read the quoted Codex chapter: http://codex.wordpress.org/Function_Reference/in_category