Use php to hide anchor text on Wordpress custom field -


i noob @ php & trying create wordpress template using advanced custom fields plugin. template want need hide anchor text (the text says bio) not show on page unless there information entered coach_bio_1 field. field data wrapped in div shows fancybox when link clicked. here code, realize simple fix, help

    <div class="coach_info">              <div class="coach_pic"><img src="<?php the_field('coach_pic_1'); ?>" /></div>             <div class="coach_content">                 <p class="coach_title"><?php the_field('coach_name_1'); ?></p><br />                 <p><?php the_field('coach_title_1'); ?></p><br />                 <p><?php the_field('coach_email_1'); ?></p>                 <a href="#bio_1" class="fancybox">bio</a>                 <div style="display:none;">                 <div id="bio_1">                 <?php the_field('coach_bio_1'); ?>                 </div>                 </div>             </div>          </div><!-- coach_info --> 

like this:

<?php if ( get_field('coach_bio_1') ) { ?>     <a href="#bio_1" class="fancybox">bio</a>     <div id="bio_1">         <?php the_field('coach_bio_1'); ?>     </div> <?php } ?> 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -