Home Forums Front-end Issues Custom fields only displaying on some pages


Custom fields only displaying on some pages

  • Hi, I have several custom fields (text and checkboxes) for my wordpress posts. I entered data for all of them but some aren’t displaying on specific posts. I don’t see any difference between the posts so I can’t tell why some are working and others aren’t. For example, in my code I have ‘architect’ and ‘location’ fields, and architect isn’t displaying on the front end one post and location isn’t displaying on another. Any help would be appreciated!!

    Code here:

     <div class="metabox">
    <ul style="list-style-type:none;">
    	<?php if (get_field('location')):?> 
    		<li>Location: <?php the_field('location'); ?></li>
    		<?php endif; ?> 
    	<?php if (get_field('architect')):?> 
    		<li>Architect: <?php the_field('architect'); ?></li>
    		<?php endif; ?> 
    	<?php if (get_field('building_type')):?> 
    		<li>Building Type: <?php the_field('building_type'); ?></li>
    		<?php endif; ?> 
    	<?php if (get_field('materials')):?> 
    		<li>Materials: <?php the_field('materials'); ?>	</li>
    		<?php endif; ?> 
    	<?php if (get_field('services')):?> 
    		<li>Services: <?php the_field('services'); ?> </li>
    		<?php endif; ?> 
  • There is nothing in the code that you’ve provided that explains why some fields are not shown in some cases and you’ll need to supply more information. It could have to do with the type of field, it could have to do with where your code is located and how it’s called.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.