Support » Fixing WordPress » It seems so easy – PHP and the_title

  • 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!

Viewing 1 replies (of 1 total)
  • 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.

Viewing 1 replies (of 1 total)
  • The topic ‘It seems so easy – PHP and the_title’ is closed to new replies.