Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
You cannot have semi-colons immediately after if conditions.
Remove the semi-colon,
from
if (current_user_can('edit_comment',$comment->comment_ID) );
Thread Starter
vahyd
(@vahyd)
thanks.. but now I’m getting
syntax error, unexpected ‘{‘
now it looks like
<?php if (current_user_can('edit_comment',$comment->comment_ID) ) { ?>
<a href="<?php echo get_edit_comment_link(); ?>" title="Edit Comment">
<img src="<?php echo get_template_directory_uri();?>/images/edit-link.png"/>
</a>
<?php } ?>
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
You still have the semi colon immediately after the if (condition).
Thread Starter
vahyd
(@vahyd)
sorry typing mistake.. semicolon was actually removed the code.
And still getting unexpected ‘{‘ error
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
I can’t see a syntax error in that code, can you post just the line in which the syntax error refers to?
Thread Starter
vahyd
(@vahyd)
It was the first line
<?php if (current_user_can('edit_comment',$comment->comment_ID) ) { ?>
I’ve got it working fine now. Will paste the code later in case someone wants to check it
Thread Starter
vahyd
(@vahyd)
This is the code that worked for me.
<?php if (current_user_can('edit_comment',$comment->comment_ID)) : ?>
<a href="<?php echo get_edit_comment_link(); ?>" title="Edit Comment">
<img src="<?php echo get_template_directory_uri();?>/images/edit-link.png"/>
</a>
<?php endif;?>
I think my previous code (the code after removing the semicolon) had something to do with the server settings.