• Resolved Bennyjh

    (@bennyjh)


    Can’t get this to work for some reason;

    <li><a href="#" class"<?php if (the_title()=='Home' { echo 'current-page'; } ?>">Home</a></li>

    Should I be using a different wordpress function? Any help would be appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Assuming that this is within the Loop, try:

    <li><a href="#" class"<?php if (get_the_title()=='Home' { echo 'current-page'; } ?>">Home</a></li>

    Thread Starter Bennyjh

    (@bennyjh)

    Thanks for the help, but I managed to get it working.

    For anyone interested;

    <li><a href="#" <?php if(is_page('Home')){ echo 'class="current-page" style="color:#FFF"'; } ?>>Home</a></li>

    You can also use is_front_page()

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘If the_title() echo into a HTML class’ is closed to new replies.