• cclass

    (@cclass)


    Hello,

    Although I have a 404.php file in my custom template directory, anytime a 404 is thrown, my site goes to page.php and displays nothing. The title of the page is ‘Page Not Found’ because it’s trying to call the page title and my side bar (which should show the current page and any parent or sub pages) shows links to every single one of my pages.

    As a work around for now I have used the is_404 function to display an error which works just fine however I don’t understand why the custom 404.php is not being called. I am using php include to show the content of the 404.php file.

    I’ve tried to follow WP troubleshooting with no luck

    perma link settings: /%year%/%monthnum%/%postname%/

    Not sure what other info would be useful for troubleshooting.

    Again, the page that you’ll see if you try to go to a page that doesn’t exist is the page.php file.

    Thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • esmi

    (@esmi)

    Although I have a 404.php file in my custom template directory

    Sorry? Custom template directory? That’s not part of WordPress core. What theme are you using? Where did you download it from?

    Thread Starter cclass

    (@cclass)

    By custom template directory, I meant the directory where my custom theme is located (e.g. wp-content/themes/themename/404.php)

    esmi

    (@esmi)

    Ah! A child theme! What parent theme are you using? What happens if you switch back to the parent theme?

    Thread Starter cclass

    (@cclass)

    Hmm..I’m new to theme development so forgive my ignorance but I don’t believe this is a child theme. The theme I’m developing is the only theme in that directory and (I don’t think, at least not intentionally) does my theme inherit anything from another theme.

    esmi

    (@esmi)

    So is this a custom theme? If not, where did you download it from?

    Thread Starter cclass

    (@cclass)

    Yes, it is a custom theme.

    esmi

    (@esmi)

    In that case, I would suggest that you start stripping back your theme’s template files. It sounds like there’s a problem in the way that they are using the Loop. Or perhaps you’re running multiple Loops on a page – which can cause some really unpredictable behaviour unless they’re implemented properly.

    Thread Starter cclass

    (@cclass)

    So I tried deleting all content from page.php and 404’s still go to this page (indicated by a blank page…)

    How would issues with the loop affect 404’s?

    esmi

    (@esmi)

    As I said, implementing the Loop incorrectly can cause some pretty strange behaviour. What happens if you switch to the default permalink structure?

    Thread Starter cclass

    (@cclass)

    I use this code anytime I start the loop:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    stuff
    
    <?php endwhile; endif; ?>

    More specifically this is used on index.php (the file where my posts are. I have a static home page), page.php, single.php and any custom page template.

    Thread Starter cclass

    (@cclass)

    Not sure if this is related, or just the default that I need to change, but when I view posts by month or year they show up using page.php as well.

    For example, if I went to https://site.com/2013/01 I would see all the posts for January but they would use page.php. I can fix this by using is_archive() but would prefer they go to another template.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘404's going to page.php’ is closed to new replies.