因此,我使用下面的标记来显示一个简短的代码:
<div class="my_edit_button">
<?php echo do_shortcode('[something]'); ?>
</div>然后我试图使它的短码只显示给帖子作者使用以下内容:
return ($post->post_author == $current_user->ID);但我不确定如何将两者合而为一。
有谁能帮帮我吗?
发布于 2015-12-25 05:08:13
您可以控制作者是否为当前用户,如果是,则打印您的按钮。我认为像这样的东西是可行的。
<?php if($post->post_author == $current_user->ID): ?>
<div class="my_edit_button">
<?php echo do_shortcode('[something]'); ?>
</div>
<?php endif; ?>https://stackoverflow.com/questions/30178300
复制相似问题