0

How can I get the Title of a Home Page to appear?

I am using the Quark "out-of-the-box" Front Page Template.

Home Page "view source":

<article id="post-1" class="post-1 page type-page status-publish hentry">
    <div class="entry-content">

Inner Page "view source":

<article id="post-2" class="post-2 page type-page status-publish hentry">
        <header class="entry-header">
        <h1 class="entry-title">Inner Page</h1>
                </header>
    <div class="entry-content"> 

2 Answers 2

2
$id_frontpage = get_option('page_on_front');
echo get_the_title( $id_frontpage );

If you need the ID of the page that displays posts use get_option('page_for_posts').

0

To return the name of your page, simply:

<header class="entry-header">
    <h1 class="entry-title"><?php echo get_the_title( $ID ); ?></h1>
</header>

Ref: https://codex.wordpress.org/Function_Reference/get_the_title

1
  • Ok, thanks @Archie22is. Would you happen to know why the page title does not appear when a page is set to "Font Page" in the Settings > Reading ? Is that a limitation in WordPress?
    – tammy
    Oct 1, 2015 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.