vendredi 2 septembre 2016

PHP if is_singular doesn't always work

I'm using PHP in wordpress to apply a button to the base of a page, if a page is a certain category.

The categories are: heads_blog, alumnae and post (for default posts).

heads_blog works fine, post works fine, but alumnae does not.

Is this a PHP problem or something else?

    <section class="cta_wrap">

<?php if(!empty($doc_download)): ?> 
    <a href="<?php echo $doc_download;?>" target="_blank"  class="button-three button wide download"><?php echo $doc_text;?><span></span></a>
<?php endif; ?>

<?php  if ( is_singular( 'heads_blog' )) : ?>
    <a href="/news-views/julies-blog/" class="button-four button wide"><span></span>Read more blog posts</a>
<?php endif; ?>

<?php  if (is_singular('alumnae')) : ?>
    <a href="/alumnae/alumnae-news/" class="button-four button wide"><span></span>Read more <?php echo $post_type_cta; ?></a>
<?php endif; ?>

<?php  if (is_singular('post')) : ?>
    <a href="<?php echo bloginfo('url') . $post_type_cta_url ; ?>" class="button-four button wide"><span></span>Read more NOT<?php echo $post_type_cta; ?></a>
<?php endif; ?>

</section>

Aucun commentaire:

Enregistrer un commentaire