So, I have following markup to show a shortcode:
<div class="my_edit_button">
<?php echo do_shortcode('[something]'); ?>
</div>
Then I am trying to make it so that the shortcode is only shown to post author by using the following:
return ($post->post_author == $current_user->ID);
But I am not sure how to incorporate both into one.
Could someone help me out?
You can control if the author is current user and if TRUE print your button. I think something like this can work.
<?php if($post->post_author == $current_user->ID): ?>
<div class="my_edit_button">
<?php echo do_shortcode('[something]'); ?>
</div>
<?php endif; ?>