I am trying to display content based on if the category id matches the array. So far this code displays nothing. Unsure as to what I have coded wrong. Any help would be great.
<header class="">
<div class=""> <a title="<?=$post->post_title?>" href="<?=esc_url( get_permalink() )?>" rel="bookmark">
<div onClick="">
<?php $showmapsortfor = array(2,3);
if(in_array($_category->getId(),$showmapsortfor )):?>
<?
if ( is_single() ) :
the_title( '<h1 class="entry-title">', '</h1>' );
else :
the_title( '<h1 class="entry-title">', '</h1>' );
endif;
?>
<div>
<div id="1">A </div>
<div id="2">B </div>
</div>
</div>
</div>
</a>
</div>
<?php else: ?>
<?
if ( is_single() ) :
the_title( '<h1 class="entry-title">', '</h1>' );
else :
the_title( '<h1 class="entry-title">', '</h1>' );
endif;
?>
<div>
<div id="1">C </div>
<div id="2">D </div>
</div>
</div>
</div>
</a>
</div>
<?php endif; ?>
</header>
Aucun commentaire:
Enregistrer un commentaire