• Resolved ejwjohn

    (@ejwjohn)


    I am running a Child theme of the 2017 theme, and i want to alter the message when a 404 error is generated.

    Surprisingly the 404 message i am getting is not the same as contained within the 404.php template within the theme folder. I am no expert but where is the real 404.php that 2017 uses [lease?

    thx

    John

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi there,

    It should use the text from 404.php.

    If that’s not happening, what message are you getting?

    Can you post a link to your site?

    You may be seeing the 404 of the underlying Apache server where it pulls up its own 404 page instead of even triggering WordPress to generate a page – it never gets that far, let alone trigger the 404.php. I tend to get those if I have a URL structure that uses a “?page_id=” format.

    Try adding a statement like “ErrorDocument 404 /?page_id=999999” to your .htaccess file (if you use All In One WordPress Security, go to the “Firewall” tab and drop it in the window under “Custom Rules” and tick the box). If you use a different URL format leave out the question mark.

    This will make Apache ask WordPress for the error page, and by giving a number that doesn’t exist you’ll trigger the WP’s 404.php instead of that of the server underneath.

    Thread Starter ejwjohn

    (@ejwjohn)

    Hello,

    Web site is at

    https://lacuna.wales/

    Use the following Menu link

    https://lacuna.wales/lacuna-owner-resident/
    then when on the page select the link to either Owner or Tenant, and you will get the 404 page.

    thanks

    John

    Thread Starter ejwjohn

    (@ejwjohn)

    Hello,

    Ref the suggestion to change the Rules in All in One, i think what i am seeing is a WordPress 404 as there are elements of the WordPress theme included in the 404.

    Please see previous response.

    THANKS

    John

    Thanks for the info @ejwjohn – I can see what’s happening.

    https://lacuna.wales/lacuna-owner-resident/
    then when on the page select the link to either Owner or Tenant, and you will get the 404 page

    Neither of those are technically 404 pages, they’re empty category archive pages.

    The text for that message can be found in /template-parts/post/content-none.php

    Below is an example of a page that actually 404s. It uses the text from 404.php:

    https://lacuna.wales/404test

    Thread Starter ejwjohn

    (@ejwjohn)

    Hello,

    That is great Thank You,
    Can i ask one final question on this, if i want to use a modified content-none.php page and use it will my child theme how do i do this please?

    Thanks

    John

    You’re welcome ??

    Create a child theme, then add a folder in it called template-parts.

    Inside the template-parts folder, add another folder called post.

    Make a copy of content-none.php from Twenty Seventeen, and place it into the post folder in your child theme.

    Then make your edits to that file in your new child theme, and activate it once you’re done.

    Please note: you may need to use html entities with your text.

    For example, in the existing content-none.php, you’ll see this. Note how the text doesn’t use a single quote/apostrophe in the text.

    It seems we can’t find what you’re looking for

    ’needs to be used instead – https://www.w3.org/wiki/Common_HTML_entities_used_for_typography

    If you don’t want to use a child theme, you could use a string override plugin instead to change the text – https://wptavern.com/say-what-plugin-passes-10k-active-installs

    Thread Starter ejwjohn

    (@ejwjohn)

    Hello,

    Once again, thank You, fully resolved and i also get some useful info regarding the HTML Entities.

    Great Thanks

    John

    Thanks too – learned something new ??

    You’re welcome, glad I could help ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Where is the real 404.php template’ is closed to new replies.