De onderstaaande voorwaardes kunnen van pas komen bij het ontwikkelen van een website. Zo kun je bijvoorbeeld controleren of je op de homepage bent of op de detailpagina van een bericht en aan de hand hiervan bepaalde extra codes uitvoeren. Er is een scheiding gemaakt tussen pagina's en alles wat met berichten te maken heeft.
<?php
if(is_page('25')):
endif;
?>
<?php
if(is_home()):
endif;
?>
<?php
if(is_front_page()):
endif;
?>
<?php
if(is_search()):
endif;
?>
<?php
if(is_404()):
endif;
?>
<?php
if(is_home() OR is_page(25)): // In plaats van OR kan ook AND gebruikt worden.
endif;
?>
<?php
if(is_page_template('template-contact.php')):
endif;
?>
<?php
if(is_blog()):
endif;
?>
<?php
if(is_category()):
endif;
?>
<?php
if(is_tax()):
endif;
?>
<?php
if(is_singular('Lorem')):
endif;
?>
<?php
if(is_single()):
endif;
?>
<?php
if(is_post_type_archive()):
endif;
?>
<?php
if(is_object_in_term( $post->ID, 'category', 'films')):
endif;
?>
<?php
if(has_tag('Lorem')):
endif;
?>
<?php
if(has_post_format('video')):
endif;
?>
<?php
$content = get_the_content();
if(has_shortcode($content, 'gallery')):
echo 'Galerij toegevoegd';
else:
echo 'Geen galerij';
endif;
?>
<?php
$postCheck = get_posts('category_name=Homepage');
if($postCheck):
else:
endif;
?>
<?php
if(is_user_logged_in()):
endif;
?>
<?php
if(current_user_can('author')):
endif;
?>
<?php
$customfield = get_post_meta($post->ID, 'Veldnaam', true);
if ($customfield == ''):
else:
endif;
?>