Todd Vance
Todd Vance

Reputation: 4711

Php - trying to add li to current list but not getting the LI

Trying this: - UPDATE -- SOOORRY!

  <li><a href="index.php" class="first">Home</a></li>
<?php  
        if (the_title() == "language-translation") 
           print("<li><a href='become-a-volunteer'>Become a Volunteer</a></li>");
     ?>
    <li><a href="#"><?php the_title(); ?></a></li>

All I get is the TEXT ('Become a volunteer') and not the LI item...(or the anchor for that matter) ? -- Forgive me but I pasted a mistake.. this is STILL not working above.

I get the TEXT regardless of whether the if is true or not and never get the LI and A

Upvotes: 0

Views: 149

Answers (2)

Daniel Benzie
Daniel Benzie

Reputation: 479

try

if (the_title() == "language-translation") ?>

  • Become a Volunteer
  • reason it doesnt work is because you ended PHP before you enter print (a PHP command)

    Upvotes: 2

    Patrick at CloudBudgie
    Patrick at CloudBudgie

    Reputation: 785

    You are closing the PHP tag at the end of the if statement. Remove the end "?>"

    if (the_title() == "language-translation") ?>

    Upvotes: 6

    Related Questions