Custom 404 page
Flynn, I apologize in advance for yet another question! I think I'm so inspired by Atahualpa that I can't stop thinking of ways to enhance the website by using it.
I've been reading about improving the user experience by presenting a better 404-File Not Found page. The Codex has a lot about it, and I even found a plugin (Useful 404's) that would help create a better page. But Atahualpa doesn't seem to have a 404.php to edit. I notice that index.php has the "Sorry, what you're looking for isn't here" near the footer. I was able to change that to something a bit nicer, but I didn't hack around any further. Can we create a 404 page and have it intercept the lost user, and can we customize it via the plugin or by just pasting in some code we find elsewhere, like alistapart.com? And do we need to point to it via the .htaccess file? |
You can copy index.php as 404.php but it needs to have the upper part of index.php up to <?php get_header(); ?> and the <?php get_footer(); ?> at the bottom
Whenever a Wordpress page (any type) is being requested Wordpress first looks for a specific template for the given page type, then for a less specific template, and finally falls back to index.php. In Atahualpa's default state it always falls back to index.php because there's no page.php, 404.php etc. Here's the Wordpress page template hierarchy, which is also a list of page templates you can create by copying and editing index.php http://codex.wordpress.org/File:Template_Hierarchy.png |
hello
I am glad to have found this post on the forum (by the way the search function of the forum did not found "404" Keyword). I have the same question of setting a specific 404 page I do not understand what you mean by Quote:
thanks seneque |
I have solved my problem by modifying index.php.
In fact there is no need for a specific 404 page I have added a sitemap and the google script seneque |
Yes, you can either put everything into index.php (that's how Atahualpa does it) or make a copy of index.php and save that as "404.php" and upload it. Wordpress will automatically use that 404.php file if a page was not found.
Having many different files (index.php, page.php, home.php, category.php, 404.php, author.php......) is a more static and traditional approach but has the benefit that it requires less PHP code such as if ( is_page() ) { do this } and if ( is_category() ) { do that } The downside is more redundancy as most of these files will probably be identical to some extent, and edits will often have to be repeated in each file. The downside to the all-in-one index.php approach of Atahualpa is that most tutorials on the web are geared towards the traditional approach and users are wondering "where is page.php ?" |
Can you use html for <a> tags in your Not Found part of the Style Center area of the index.php? I tried it and I got an error message. I'd like add a few helpful links in this area:
Content if NOT FOUNDAdd/edit/remove the content here that is displayed on "404 Not Found" pages. Can you give a head start of the format for adding more html than just <p> tags. I know html, but I mean to add it into this line: <h2><?php _e('Not Found','atahualpa'); ?></h2> <p><?php _e("Sorry, but you are looking for something that isn't here.","atahualpa"); ?></p> I do not want to try to make a custom 404 if I can do it in the index.php. Thank you, X |
Hi there, yes please, as X said, can we have some examples? Thanks
|
you can use links in the ato->Style & edit CENTER COLUMN->Content if NOT FOUND
HTML Code:
<h2><?php _e('Not Found','atahualpa'); ?></h2> |
Thank you, this is useful. Do you know if it's possible to have a site map there, is it easy to insert?
|
PS, any reason to use PHP then?
For instance, Quote:
Quote:
|
Try them both and see what happens.
|
Both work. Is it not supposed to?
|
They will both work to give you some text. Here is more of an explanation of what the code is for.
|
Thank you, it's quite technical :P
|
Under ATA > Style and Edit Center Column I don't see the Content if not found option. Has it moved in Atahualpa 3.6.7 ?
|
PHP code isn't allowed anymore in the Atahualpa Theme Options. Atahualpa was one of few themes, if not the only theme, to allow custom PHP code to be inserted through theme options.
WordPress's philosophy as to what themes should or should not be able to do (i.e. which PHP functions they can use) has been tightened up quite a bit lately, so in order to stay listed on wordpress.org we had to remove this 'custom PHP' feature You will now have to edit index.php and make the changes there, see lines 53-54 |
All times are GMT -6. The time now is 03:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.