我使用高级自定义字段编码了一个页脚部分,其中社交图标有自己的字段标签、名称和类型。您可以看到下图:
现在你看到它说如果Page等于Home,则显示此字段组,逻辑方法是添加“并且Page等于About Us”等等,但当我尝试时,它不起作用。我不知道如何让这个自定义字段显示在我网站的所有页面上。以下是它在所有页面上的外观:
这是我的页脚。php文件:<?php
// Custom Fields
$modal_title = get_post_meta(14, \'modal_title\', true);
$modal_body = get_post_meta(14, \'modal_body\', true);
$modal_logo = get_post_meta(14, \'modal_logo\', true);
// Advanced Custom Fields
$twitter_username = get_field(\'twitter_username\');
$instagram_username = get_field(\'instagram_username\');
$facebook_username = get_field(\'facebook_username\');
?>
<!-- FOOTER -->
<footer class="footer">
<div class="container">
<div class="col-lg-12">
<?php if(!empty($twitter_username)) : ?>
<a href="https://twitter.com/<?php echo $twitter_username; ?>" target="_blank" class="badge social twitter"><i class="fa fa-twitter"></i></a>
<?php endif; ?>
<?php if(!empty($instagram_username)) : ?>
<a href="https://instagram.com/<?php echo $instagram_username; ?>" target="_blank" class="badge social instagram"><i class="fa fa-instagram"></i></a>
<?php endif; ?>
<?php if(!empty($facebook_username)) : ?>
<a href="https://facebook.com/<?php echo $facebook_username; ?>" target="_blank" class="badge social facebook"><i class="fa fa-facebook"></i></a>
<?php endif; ?>
</div>
<div class="col-md-12">
<p>© 2008-2017 Three Green Birds. All Rights Reserved.</p>
</div>
</div>
</footer>
<!-- DONATE
========================================================================== -->
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel"><i class="fa fa-envelope"></i> <?php echo $modal_title; ?></h4>
</div><!-- modal-header -->
<div class="modal-body">
<p><?php echo $modal_body; ?></p>
<?php echo $modal_logo; ?>
</div><!-- modal-body -->
</div><!-- modal-content -->
</div><!-- modal-dialog -->
</div><!-- modal -->
<?php wp_footer(); ?>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
</body>
</html>