0

I was using this code perfectly but now I'm getting a error 500 on site. Removing it make the site work.

    <?php
    do_action( 'storefront_before_header' ); ?>

    <header id="masthead" class="site-header" role="banner" style="<?php storefront_header_styles(); ?>">



<div class="logad" id="logad">

<?php
if ( is_user_logged_in() ) {
global $current_user;
get_currentuserinfo();

echo '<ul class="logad" >
            <li class="o">Olá, '.$current_user->user_firstname.'.</li>
            <li class="d">
<a href="https://3brow.com/minha-conta" class="ver">Ver minha conta</a>
<a href="https://3brow.com/minha-conta/Sair/" class="sair">Sair</a></li>
        </ul>';
} else {
echo '<ul class="ent">
            <li><a href="#">Entrar</a></li>
            <li><a href="#">Registrar</a></li>
        <?php   do_action( 'wooc_save_extra_register_fields' ); ?>
        </ul>';
}
?>

</div>

Any help to see what's wrong?

Robert
  • 104
  • 6
  • 2
    Check your PHP logs and/or turn on error reporting to see what the actual error is. At the very least, your `else` block looks like a variety of syntax errors. – David Mar 12 '17 at 16:40
  • 1
    Try double quotes mark " outside, single quotes mark ' inside. – b2ok Mar 12 '17 at 16:43
  • http://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display for future reference – apokryfos Mar 12 '17 at 17:04

3 Answers3

1

using php tag inside another php tag which is illegal so to speak:

echo '<ul class="ent">
            <li><a href="#">Entrar</a></li>
            <li><a href="#">Registrar</a></li>
        <?php   do_action( 'wooc_save_extra_register_fields' ); ?>
        </ul>';
}

should be as follows:

echo '<ul class="ent">
            <li><a href="#">Entrar</a></li>
            <li><a href="#">Registrar</a></li>
            ' . do_action( 'wooc_save_extra_register_fields' ) . '
        </ul>';
}
hassan
  • 7,013
  • 2
  • 20
  • 32
1

I am not wordpress expert but instead

echo '<ul class="ent">
            <li><a href="#">Entrar</a></li>
            <li><a href="#">Registrar</a></li>
        <?php   do_action( 'wooc_save_extra_register_fields' ); ?>
        </ul>';

use

echo '<ul class="ent">
            <li><a href="#">Entrar</a></li>
            <li><a href="#">Registrar</a></li>'
        . do_action( 'wooc_save_extra_register_fields' ) .
        '</ul>';
pawelwaw
  • 54
  • 5
1
echo "<ul class='logad' >
            <li class='o'>Olá," . $current_user->user_firstname . "</li>
            <li class='d'>
<a href='https://3brow.com/minha-conta' class='ver'>Ver minha conta</a>
<a href='https://3brow.com/minha-conta/Sair/' class='sair'>Sair</a></li>
        </ul>";
} else {
echo "<ul class='ent'>
            <li><a href='#''>Entrar</a></li>
            <li><a href='#''>Registrar</a></li>"
        . do_action( 'wooc_save_extra_register_fields' ) . "</ul>";
}
b2ok
  • 552
  • 6
  • 13