首页 > 解决方案 > Wordpress 高级自定义字段未显示在前端

问题描述

我正在研究我的 WordPress 子主题并使用高级自定义字段,但我很难在前端显示其中一个。

    <?php if( get_field('pp-full-image') ): ?>

<? // closes main .row and .container from header & inserts full width image ?> 
</div><!-- .row from header -->
</div><!-- .container from header -->

<div class="pp-sub" style="background-image: url(<?php the_field('pp-full-image'); ?>)"></div>

<!-- .pp-sub -->

<? // displays section 3 content ?>
<?php $ppsec3 = get_field('pp-section3');
if( $ppsec3 ): ?>
<div class="container">
    <div class="row">


            
                <div class="pp-sec sec3">
                    <h3 class="pp-title sec3"><?php echo ( $ppsec3['pp-section3-title'] ); ?></h3>
                    <div class="pp-txt sec3">
                        <?php echo ( $ppsec3['pp-section3-text'] ); ?>
                    </div>
                </div>
                
        </div><!-- /.pp-wrapper -->
</div>
<?php endif; ?>     
<? // closes section 3 content ?>
<?php endif; ?>
<? // closes full width image and section 3 content  ?>
<?php
get_footer();

标签: phpwordpressadvanced-custom-fields

解决方案


推荐阅读