Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.
<?php
if ( is_user_logged_in() ) {
echo '';
} else {
echo '<a onclick="ppOpen('#login_panel', '800',1)" href=\"javascript:\">Entrar</a>';
}
?>

Hello, I'm trying to make this work but i'm not sure how to do the syntax.... any help would be great! thanks!

share|improve this question
    
<?php if ( is_user_logged_in() ) {echo ''; } else { echo "<a onclick=\"ppOpen('#login_panel', '800',1)\" href=\"javascript:\">Entrar</a>"; } ?> I've done this and it works, do you think is correct? –  Lucas Jul 27 at 15:19

1 Answer 1

It is string escape problem with PHP Syntax

Correct Code:

<?php
if ( is_user_logged_in() ) {
echo '';
} else {
echo '<a onclick="ppOpen(\'#login_panel\', \'800\',1)" href="javascript:void(0)">Entrar</a>';
}
?>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.