Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages »

Custom 404 Page


  #1  
Old Aug 2, 2011, 11:27 PM
pyoterguru
 
36 posts · Mar 2010
Hi,

I need to redirect 404's to a custom 404 page saved as draft, not published.

How do I do this?
  #2  
Old Aug 3, 2011, 05:38 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
by it's nature, a draft page won't be displayed
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Aug 3, 2011, 08:57 AM
pyoterguru
 
36 posts · Mar 2010
Alright, tried saving the 404 draft page as complete web page, then uploaded to root of my server.

Typing "http://mysite.com/404.html" at the browser address bar displays the custom 404 page fine, but how do I configure Atahualpa to load this page for site 404's?
  #4  
Old Aug 19, 2011, 01:07 AM
pyoterguru
 
36 posts · Mar 2010
Any resolution on this?
  #5  
Old Aug 19, 2011, 04:40 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
there are two ways a 'Not Found can occur
1) a page just doesn't exist
2) you search for something that is not found

Case 1
In this case you need a 404.php file in the theme folder. Here is an example for release 3.6.7
HTML Code:
<?php
/**
 * for displaying 404 pages (Not Found).
**/
?>
<?php 
list($bfa_ata, $cols, $left_col, $left_col2, $right_col, $right_col2, $bfa_ata['h_blogtitle'], $bfa_ata['h_posttitle']) = bfa_get_options();
get_header(); 
extract($bfa_ata); 
?>

your code goes here

<?php get_footer(); ?>
This will format the page like any other page on your site

case 2:
In this case, edit index.php and look at the bottom where you will see
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>
just change the message to what you want
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #6  
Old Aug 30, 2011, 07:50 AM
pyoterguru
 
36 posts · Mar 2010
Thanks a lot.
  #7  
Old Apr 27, 2012, 12:55 PM
Hody's Avatar
Hody
 
156 posts · Apr 2012
So can just the upper code be used the create a custom 404 page and has the lower part then stripped from the index.php?
__________________
...that I rock, doesn´t mean I am made of stone!
My Blog: Diary of a Fatman - Run Fatboy Run! - Tribe Online Magazine - Freiburg
  #8  
Old May 10, 2012, 08:56 AM
freelancekonsulenten's Avatar
freelancekonsulenten
 
45 posts · Oct 2009
Denmark
I have tried to make a 404.php but it don't show the styling of the pages.
Normally my pages shows like this http://www.torbenbendixen.dk/om/
But if I type an error page http://www.torbenbendixen.dk/hfdga it doesn't show like the normal pages.

What am I doing wrong?

I am using version 3.7.6
__________________
WordPress blogs og hjemmesider og webshops
  #9  
Old May 10, 2012, 09:57 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
the n'normal' pages are in a post div while your 404 page is not so the styling is not being set. I suggest you look at teh 'normal' page and see teh way the text is wrapped in a <div...>...</div> and add that to your code creating the 404
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #10  
Old May 10, 2012, 10:27 AM
freelancekonsulenten's Avatar
freelancekonsulenten
 
45 posts · Oct 2009
Denmark
Thank you for this.
I am not sure what you mean by teh?
I have searched the forum for "normal page" but can't find something that can help me.
__________________
WordPress blogs og hjemmesider og webshops
  #11  
Old May 10, 2012, 10:53 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
by 'normal' I was refering to the page you used in the example, the way your pages 'normaly look.

The center area is made up of come divs that have classes and the classes are styled in the theme settings. Your 404 page does not have this div of teh clsasses so the styling is not applied.

You can add a new div and style it in the css options or
look at the code and see the existing div and classes and wrap your ode in it so the theme styling will apply.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #12  
Old May 11, 2012, 02:53 AM
freelancekonsulenten's Avatar
freelancekonsulenten
 
45 posts · Oct 2009
Denmark
I see what you mean.
Thank you for this!!

I got it working now.
__________________
WordPress blogs og hjemmesider og webshops
  #13  
Old May 17, 2012, 03:57 AM
Hody's Avatar
Hody
 
156 posts · Apr 2012
Quote:
Originally Posted by freelancekonsulenten
I see what you mean.
Thank you for this!!

I got it working now.
Would you plese post what code you have used now in the end, I am having problems accomplishing this
__________________
...that I rock, doesn´t mean I am made of stone!
My Blog: Diary of a Fatman - Run Fatboy Run! - Tribe Online Magazine - Freiburg
  #14  
Old Jun 7, 2012, 02:14 PM
freelancekonsulenten's Avatar
freelancekonsulenten
 
45 posts · Oct 2009
Denmark
First I use this plugin: http://wordpress.org/extend/plugins/useful-404s/

Then I create a file called 404.php, and put this code in the file:

<?php
/**
* for displaying 404 pages (Not Found).
**/
?>

<?php
list($bfa_ata, $cols, $left_col, $left_col2, $right_col, $right_col2, $bfa_ata['h_blogtitle'], $bfa_ata['h_posttitle']) = bfa_get_options();
get_header();
extract($bfa_ata);
?>

<div style="display: block; margin: 0 0 5px 0; padding: 10px 20px; background: white; -moz-border-radius: 10px; -khtml-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; border: solid 1px #E5E5E5;">

<?php
useful404s();
?>

</div>

<?php get_footer(); ?>

I then upload the 404.php file to the theme directory.

The code in the <div> should be the same code as your own design.
__________________
WordPress blogs og hjemmesider og webshops
  #15  
Old Mar 26, 2016, 02:10 PM
ravibandakkanavar
 
3 posts · Jul 2010
Hi juggledad,

Thanks a lot for your help.

For better SEO purpose, I want to return a status 404 for soft 404 not found errors.

I tried to add redirection code in the else part of index.php but I failed with all the possible types of codes. Added a 404 page also. Could you please help me with this.
  #16  
Old Mar 26, 2016, 04:57 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
see https://codex.wordpress.org/Function.../status_header
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #17  
Old Mar 27, 2016, 11:19 AM
ravibandakkanavar
 
3 posts · Jul 2010
Hi,

I added the following code and the page is returning 404. Thanks for this.
else /* No posts */
<?php status_header( 404 ) ?>

<h2><?php _e('Not Found','atahualpa'); ?></h2>
<p><?php _e("Sorry","atahualpa"); ?></p>

I was actually trying to return the http status 404 and also redirect it to 404.php page. I could not do it.
  #18  
Old Mar 28, 2016, 04:37 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
That will return a 404 - check your log - AND it will run a 404.php if you have one in the atahualpa folder. However it will show inside the atahualpa page you are building.

one other thing - a search for something that is not found will NOT generate a 404
if you create a link to a page that doesnot exist, that WILL create a 404

so a search for 'this-text-does-not-exist' will (probably) just return a not found (The text in index.php)
entering a url of http://yourdomani.com/this-text-does-not-exist should result in a 404 and what ever you have in your 404.php or the text in index.php.

if you want the 404 to redirect to a completly different page without your Atahualpa settings, you will probably need to add a 404 redirect in your htaccess file (if you don't know how - do a google search)
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom 404 page paulae Atahualpa 3 Wordpress theme 15 Jul 5, 2011 04:42 AM
custom 404: Dunstan-style Error Page Plugin twincascos Plugins & Atahualpa 3 Dec 20, 2010 08:26 AM
[SOLVED] a parse error rather than the 404 page displayed when page not found lhanft Atahualpa 3 Wordpress theme 4 Oct 22, 2009 08:04 PM
Custom 404 Page and IE 8 abroadinspain Atahualpa 3 Wordpress theme 4 Sep 29, 2009 09:20 AM
What is the URL of the 404 page ? 3ukman Header configuration & styling 1 Sep 5, 2009 06:41 PM


All times are GMT -6. The time now is 03:46 AM.


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