WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Current Page (3 posts)

  1. lleger
    Member
    Posted 8 years ago #

    I have a pure css menu at the header of my blog and am trying to get it to highlight the current page with the css class "current". I have the code:

    <li><?php if is_page() echo class="active" ?></li>
    I thought that this would work but it spits out this ugly error:Parse error: parse error, unexpected T_STRING, expecting '(' in .....

    Any ideas? Did I code it wrong? Thanks.

  2. Kafkaesqui

    Posted 8 years ago #

    <li <?php if(is_page()) echo 'class="active"'; ?>></li>

    Always quote your strings in a PHP echo.

  3. lleger
    Member
    Posted 8 years ago #

    Oh. Right, thanks for spotting my error. This fixes the problem.

Topic Closed

This topic has been closed to new replies.

About this Topic