How to get page title in wordpress

Well, I have tried
<?php echo get_the_title('About Us');?>

But the code is not working. I am using wordpress 4.1. This should work but it isn’t. Has wordpress updated the functions?

Related posts

Leave a Reply

6 comments

  1. Try this one,may it’s help you

    <?php echo get_the_title(); ?>
    

    And if you want to get page or post title By id

     <?php echo get_the_title(post->$ID); ?> 
    

    Thanks

  2. You are giving wrong parameters to get_title. See the codex.

    You should have used ID instead to get the title.

    So your code would be

     <?php echo get_the_title(13); //where 13 is the ID of the about us page ?>
    

    NOTE: Parameters are optional.