WordPress.org

Ready to get started?Download WordPress

Forums

It seems so easy - PHP and the_title (2 posts)

  1. matthewboh
    Member
    Posted 4 years ago #

    My user wants the title of the page to be "Frequently Asked Questions" instead of "FAQ's", so I added the following code (with some stuff to make sure that I'm not insane...

    <?php $changetitle = the_title("","",FALSE);
          echo "|$changetitle|";
          if( $changetitle == "FAQ's" ) {
              echo "Frequently Asked Questions"; }
          else {
              echo $changetitle; }
    ?>

    Looks right to me but I get:

    |FAQ’s|FAQ’s

    as the title on the page. What am I doing wrong? I've been looking at this for four hours!

  2. iridiax
    Member
    Posted 4 years ago #

    You don't need $changetitle echoed for a second time in the else condition because it's already echoed once by default. Also, the apostrophe in FAQ's may be being returned by the_title as:

    AndHash039;

    Note: This forum will not display the actual code for an apostrophe.

Topic Closed

This topic has been closed to new replies.

About this Topic