Custom Field Display
I’ve got a template for a website that I’m making, however not all the products that I sell have text for every single field. My php is not that great so I’m looking for a way to hide a fairly large div that contains an image and some custom field text.I know the basic structure but my knowledge of all the synax regarding the quotations and double quotations is really poor. This is the div that I need to hide if the custom field ‘answer_text’ is empty, but display if it contains any text:
<!--MODUAL BOX--> <div class="modual_box"> <div class="modual_box_icon"> <img src="<?php bloginfo('template_directory'); ?>/images/faq_title_icon.gif" /> </div> <h2>Frequently Asked Questions</h2> <p> <?php echo get_post_meta($post->ID, 'answer_text', true); ?> </p> </div> <!--END MODUAL CONTAINER--> <div class="divider"> <div class="dark"> </div> <div class="light"> </div> </div> <!--FAQS END MODUAL BOX-->
- The topic ‘Custom Field Display’ is closed to new replies.