• I have a static front page and a blog page.

    The blog page uses the title of the latest post as the page title (wrapped in <h1> tags) but I would like it just to say “Blog”.

    I have copied blog.php over to custom_blog.php and set it as the page template.

    I then changed
    <h1 class="page-title"><?php the_title(); ?></h1>
    to
    <h1 class="page-title">Blog</h1>
    in custom_blog.php and refreshed the page but there is no change.

    Where am I going wrong?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter mattltm

    (@mattltm)

    It looks like the blog page is using the index.php file rather than the custom_blog.php file.

    I have no idea why!

    Hey mattitm,

    Are you aware that custom_blog.php isn’t apart of the Template Hierarchy so it won’t be automatically adopted as the Blog landing page?

    You’ll need to rename it to home.php and verify that you’ve selected a Posts Page in Settings -> Reading -> Static Page.

    There are other options too but I wouldn’t recommend any of them.

    Thread Starter mattltm

    (@mattltm)

    Ah, so its calling index.php because it cant find home.php.

    I assumed that when I created a new page called Blog, set the page template to custom and set Settings -> Reading -> Static Page to that page it would use the custom template.

    I guess not ??

    I copied index.php to home.php and made my changes. Seems to work fine.

    Thanks.

    Great! Yeah this is kind of a wonky aspect of WordPress. It’s getting ironed out gradually but this template hierarchy is so integrated with the original code base it’s a pretty serious overhaul. Good luck!

    Your main posts page will always use the index.php template file by default. As for using home.php instead of index.php, that’s actually WordPress trying to be backwards compatible. The use of home as the default index page in any site goes back to circa 1995 and is rarely used these days.

    Thanks for the insight esmi. That’s the sense I got so I’m glad to hear some confirmation of that.

    I would append to the original question then and ask what we should use if home.php is sort of on it’s way out? (Right?)

    Thread Starter mattltm

    (@mattltm)

    Yes, thanks esmi.

    Looks like I should be modifying the index.php. Will this cause any other issues further down the track? Do any other pages use index.php apart from the mail blog display?

    what we should use if home.php is sort of on it’s way out?

    Personally, I’d say just stick with index.php. I think you’ll find that this is far more widely supported across the web and from host to host. In terms of WordPress specifically, you could create a front-page.php template file *if* you want a display that is roughly the same whether the site uses a static front page or a list of recent posts. In this kind of theme, the main posts page will use front-page.php if it is the configured front page (as per Settings -> Reading) but will still default to index.php if you opt to use a static front page.

    Does that make sense?

    Haha, not entirely.

    In my scenario, my customers typically want a unique design for the front page (front-page.php), a unique design for general subsequent pages (index.php -> content-page.php), and a unique design for the Blog’s landing page (home.php).

    Do you see any weakness with that hierarchy? I’ve always felt like “home.php” was a poor naming convention and developers should introduce something like “blog-landing.php or “blog-page.php”, etc…

    What’s the difference between a site’s front page and its landing page?

    A website has a front page (website landing page) and a blog (landing page).

    None of my customers use their Blog’s landing page as their website’s landing page (for example).

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Removing post title from blog page’ is closed to new replies.