php - WP display content based on content id -


i trying display content based on if category id matches array. far code displays nothing. unsure have coded wrong. 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> 

after doing allot of looking around , trial , error found answer looking for.

<div class=""> <a title="<?=$post->post_title?>" href="<?=esc_url( get_permalink() )?>" rel="bookmark">     <div onclick="">      <?php if ( is_category( array(2,3) ) ) {?>        <div>         <div id="1">a </div>         <div id="2">b </div>       </div>    </div>   </a>   </div>  <?php } else { ?>  <div>     <div id="1">c </div>     <div id="2">d </div>   </div>    </div>   </a>   </div> <? } ?> 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -