I have developed a theme in wordpress. When I go to home page tab it shows "page not found" at the title. But it shows all contents of home page (index.php). If I create a page named "Home" then it shows the page content instead of my index.php contents. I want to show index.php contents when I go to home page.

here is the link http://admission247.com/

I use this code in page.php

<?php  if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="page_content">

<?php // echo '<br/><br/>'; ?>
<?php the_content(); ?>
</div>
<?php endwhile; ?>
<?php endif; ?>

Dani AI

Generated

Brief note tied to 's report and 's question: the browser tab saying "page not found" while the page body shows the index output usually means one of two things — WordPress is using a different template after a static page was created, or the request has been flagged as a 404 even though a template renders. WordPress resolves the front page like this: when "Front page displays" is set to a static page WP looks for front-page.php then page.php then index.php; when set to "latest posts" it looks for home.php then index.php. That explains why creating a page called "Home" made page.php take over.

Useful checks and quick diagnostics:

  • Inspect the theme's header.php (or any SEO/title code) for hard-coded "Page not found" text or an is_404() conditional that sets the <title>.
  • Verify Settings > Reading to see whether a static front page is assigned.
  • Look for front-page.php or home.php in the theme; their presence changes which file is used.
  • Confirm the HTTP status: use the browser Network panel or curl -I to see whether the server is sending a 404 header while rendering content — that signals the main query has been set to 404 (often from a bad custom query, query_posts(), or a plugin).

Small fixes and safe changes:

  • Prefer theme-supported title handling; add to functions.php:
    add_action('after_setup_theme', function() {
    add_theme_support('title-tag');
    });

    then remove manual title output from header.php so WordPress/SEO plugins can generate it reliably.

Quick debug (temporary):

<?php
global $wp_query;
error_log('Front page is_404=' . ($wp_query->is_404 ? 'yes' : 'no'));
?>

Remove any debug lines before going live. Back up files and clear caches when testing. These steps typically reveal whether the issue is template-priority, title-generation, or a mistaken 404 flag from a plugin/custom query.

Recommended Answers

All 2 Replies

The code you are showing looks fine. Where's the part in the Wordpress template that lets you set the <title>?

Thanks for showing interest dani.
My problem is solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.