如何在Wordpress中使用密码保护高级自定义字段
问题描述:
我在密码保护由高级自定义字段插件生成的一些自定义字段。如何在Wordpress中使用密码保护高级自定义字段
这是我需要隐藏的代码:我已经看到了这个链接https://codex.wordpress.org/Using_Password_Protection,但不知道如何使用我的代码中使用它
<h2>
<?php the_field('page_title'); ?>
</h2>
<div class="fusion-one-half one_half fusion-column">
<h2>
<?php the_field('subtitle_1'); ?>
</h2>
<?php the_field('list_1'); ?>
</div>
<div class="fusion-one-third one_third fusion-column last">
<h2>
<?php the_field('subtitle_2'); ?>
</h2>
<?php the_field('list_2'); ?>
</div>
。
任何想法?
谢谢!
答
我假定你已经有你的答案,但如果你不那么尝试以下方法:
if (post_password_required()) {
echo get_the_password_form();
} else {
'Password Protected Custom Content'
}
您可以在这里找到更详细的回应http://htotheml.com/password-protect-custom-templates-in-wordpress/