Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Atahualpa 3 Wordpress theme (http://forum.bytesforall.com/forumdisplay.php?f=2)
-   -   Custom 404 page (http://forum.bytesforall.com/showthread.php?t=1125)

paulae Apr 6, 2009 04:33 PM

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?

Flynn Apr 6, 2009 05:58 PM

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

seneque Apr 11, 2009 01:12 PM

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:

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
could you please help a bit more to set up a 404.php file ?

thanks

seneque

seneque Apr 11, 2009 01:25 PM

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

Flynn Apr 11, 2009 10:26 PM

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 ?"

X-Evolutionist Apr 5, 2010 04:01 PM

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

mimi May 4, 2011 04:13 PM

Hi there, yes please, as X said, can we have some examples? Thanks

juggledad May 4, 2011 04:42 PM

you can use links in the ato->Style & edit CENTER COLUMN->Content if NOT FOUND

HTML Code:

<h2><?php _e('Not Found','atahualpa'); ?></h2>
<p><?php _e("Sorry, but you are looking for something that isn't here.","atahualpa"); ?></p>For help, just click<a href="http://yourdomain.com/">here</a>


mimi May 4, 2011 05:12 PM

Thank you, this is useful. Do you know if it's possible to have a site map there, is it easy to insert?

mimi May 4, 2011 05:24 PM

PS, any reason to use PHP then?

For instance,
Quote:

<p><?php _e("Sorry, but you are looking for something that isn't here.","atahualpa"); ?></p>
can be simply:
Quote:

Sorry, but you are looking for something that isn't here.
What is the difference?

lmilesw May 4, 2011 05:28 PM

Try them both and see what happens.

mimi May 4, 2011 05:32 PM

Both work. Is it not supposed to?

lmilesw May 4, 2011 06:28 PM

They will both work to give you some text. Here is more of an explanation of what the code is for.

mimi May 5, 2011 08:12 AM

Thank you, it's quite technical :P

cway Jul 4, 2011 04:16 PM

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 ?

juggledad Jul 5, 2011 04:42 AM

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 10:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.