$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>advanced custom fields if field has value show main div|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

advanced custom fields if field has value show main div

matteradmin11PV0评论
Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 6 years ago.

Improve this question
<?php if( get_field('packaging_details','port','lead_time') ): ?>
<div class="prd-overview-list">    
<h3>Packaging & Delivery</h3>
    <ul>
        <?php if( get_field('packaging_details') ): ?><li><p>Packaging Details</p> <p><span><?php the_field( 'packaging_details' ); ?></span></p></li><?php endif; ?>
        <?php if( get_field('port') ): ?><li><p>Port</p> <p><span><?php the_field( 'port' ); ?></span></p></li><?php endif; ?>
        <?php if( get_field('lead_time') ): ?><li><p>Lead Time</p> <p><span><?php the_field( 'lead_time' ); ?></span></p></li><?php endif; ?>
    </ul>
</div><?php endif; ?>

i want if all 3 fields are empty, hide full div. and when any field have value, show full div

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 6 years ago.

Improve this question
<?php if( get_field('packaging_details','port','lead_time') ): ?>
<div class="prd-overview-list">    
<h3>Packaging & Delivery</h3>
    <ul>
        <?php if( get_field('packaging_details') ): ?><li><p>Packaging Details</p> <p><span><?php the_field( 'packaging_details' ); ?></span></p></li><?php endif; ?>
        <?php if( get_field('port') ): ?><li><p>Port</p> <p><span><?php the_field( 'port' ); ?></span></p></li><?php endif; ?>
        <?php if( get_field('lead_time') ): ?><li><p>Lead Time</p> <p><span><?php the_field( 'lead_time' ); ?></span></p></li><?php endif; ?>
    </ul>
</div><?php endif; ?>

i want if all 3 fields are empty, hide full div. and when any field have value, show full div

Share Improve this question asked Dec 13, 2018 at 11:42 Karan KcoresysKaran Kcoresys 135 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Please try below and let me know if any query.

<?php if( get_field('packaging_details') || get_field('port') || get_field('lead_time')): ?>
        <div class="prd-overview-list">    
        <h3>Packaging & Delivery</h3>
            <ul>
                <?php if( get_field('packaging_details') ): ?><li><p>Packaging Details</p> <p><span><?php the_field( 'packaging_details' ); ?></span></p></li><?php endif; ?>
                <?php if( get_field('port') ): ?><li><p>Port</p> <p><span><?php the_field( 'port' ); ?></span></p></li><?php endif; ?>
                <?php if( get_field('lead_time') ): ?><li><p>Lead Time</p> <p><span><?php the_field( 'lead_time' ); ?></span></p></li><?php endif; ?>
            </ul>
    </div><?php endif; ?>

Hope it will help you !

Post a comment

comment list (0)

  1. No comments so far