Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在php中添加“post_author”_Php_Wordpress - Fatal编程技术网

在php中添加“post_author”

在php中添加“post_author”,php,wordpress,Php,Wordpress,因此,我使用以下标记来显示短代码: <div class="my_edit_button"> <?php echo do_shortcode('[something]'); ?> </div> 但我不知道如何将两者结合在一起 有人能帮我吗?您可以控制作者是否为当前用户,以及是否为真,打印您的按钮。我想这样的办法行得通 <?php if($post->post_author == $current_user->ID): ?> &

因此,我使用以下标记来显示短代码:

<div class="my_edit_button">
    <?php echo do_shortcode('[something]'); ?>
</div>
但我不知道如何将两者结合在一起


有人能帮我吗?

您可以控制作者是否为当前用户,以及是否为真,打印您的按钮。我想这样的办法行得通

<?php if($post->post_author == $current_user->ID): ?>
<div class="my_edit_button">
    <?php echo do_shortcode('[something]'); ?>
</div>
<?php endif; ?>

<?php if($post->post_author == $current_user->ID): ?>
<div class="my_edit_button">
    <?php echo do_shortcode('[something]'); ?>
</div>
<?php endif; ?>