Hello,
Is it possible for mere mortals (those with zero css and virtually zero HTML skills, e.g. yours-truly) to edit the 404 Error page?
Cheers
Gee
(21 posts)
(3 voices)
Hello,
Is it possible for mere mortals (those with zero css and virtually zero HTML skills, e.g. yours-truly) to edit the 404 Error page?
Cheers
Gee
Hello KEXINO,
The file you are wanting is /wp-content/themes/infocus/404.php depending on what you are wanting to do you will also need to edit /wp-content/themes/infocus/searchform.php and /wp-content/themes/infocus/lib/includes/sitemap-content.php
Let us know if you need any help.
I am having the same issue and I do have a little coding under my belt.
I am looking to just have a short message - with a sidebar of sitemap-content.
Thanks
Hello dediger,
If you just want to display a short message then you would type it out somewhere within /wp-content/themes/infocus/404.php
The 404.php file uses the default sidebar so if you want to display some content you could use that or you could define your own sidebar to use.
How would I call up a pre-prepared sidebar in the 404.php file? I tried changing <?php get_sidebar(); ?> to the name of my 404-specific sidebar, but got a db error.
Is it something to so with the <div id="has_sidebar"> ?
Thanks.
Hello KEXINO,
You will need to replace the "get_sidebar()" line with this,
</div><!-- content -->
</div><!-- primary -->
<div id="secondary">
<div class="content">
<?php dynamic_sidebar( 'My Sidebar' ); ?>
</div><!-- content -->
</div><!-- secondary -->
</div><!-- has_sidebar's body_block -->
And then switch "My Sidebar" with the name of the sidebar you created.
Let us know if this works for you.
Works perfectly. Thank you so much.
Your welcome KEXINO, let us know if you need anything else.
Sorry to be a pain (!)
After rethinking my 404 page, I'd much rather it was simplified as much as possible. Instead, I'd like to have the following:
1) No 'teaser" area at the top
2) No breadcrumb (removed just for the 404 page)
3) Full-width (no sidebars at all)
4) After the usual "page not found" text, to just have the Search bar and the "Pages" list (i.e. no list of "Feeds", "Categories", "Internal Blog Posts", or "Archives"
Thanks in advance
In this case you would just need to delete the sections you do not want inside /wp-content/themes/infocus/404.php
For example the intro blurb is lines 12 -19, the breadcrumbs 23 - 27, etc etc.
Let us know if you need more instructions KEXINO.
I have deleted the lines you mentioned for the intro blurb and the breadcrumbs, and that works fine.
To show just links to Pages I created a new sitemap content file in infocus/lib/includes/sitemap-content.php that I called "sitemap-content-2.php" and changed the link in the 404.php file accordingly. That works great.
However, when i delete the code you gave me for the sidebar, the page formatting goes crazy.
Also, there's now a grey bar at the very bottom of that page, that I don't know how to remove.
If possible then set us up with a link to your site so we can take a closer look.
kexino.com
I've attached the current 404.php file as well.
Thanks in advance.
Didn't attach the first time around. Trying again.
Nope, that didn't take either. Plus I cannot reupload an attachment to a post.
Please send me an email address to post to, if you want the file.
Inside your 404.php add this code,
<style type = 'text/css'>
#footer { margin-top: 0px !important; }
</style>
That should get rid of the color above the footer.
Thank you, that worked.
Now, what about my problem in making the page full-width - i.e. without any sidebar?
To make it full width you'll need to switch this line,
<?php get_sidebar(); ?>
With this,
</div></div>
(if that does not look right then just use one </div>)
And delete this line,
<div id="has_sidebar">
If you check the history of this thread, you will see that I no longer have the line:
<?php get_sidebar(); ?>
in my 404 page.
My entire 404 page looks like the following. Please just correct / amend the code it as required.
<?php
get_header();
require(WEBTREATS_INCLUDES . "/var.php");
$teaser_text = get_post_meta($post->ID, 'teaser_text', true);
$teaser_text_custom = get_post_meta($post->ID, 'teaser_text_custom', true);
if ($teaser_text == 'disable' || $header_teaser == 'disable') {
$header_disable = true;
}
?>
<div class="clearboth"></div>
<div id="has_sidebar">
<div id="body_block">
<div class="inner">
<div id="primary">
<div class="content">
<?php if ($header_disable) { ?>
<h1>404 - Not Found</h1>
<?php } ?>
<div <?php post_class() ?> id="post-404">
<?php if ($header_disable) { ?>
<h5>Looks like the page you're looking for isn't here anymore. Try using the search box or sitemap below.</h5>
<?php } ?>
<img src="http://kexino.com/wp-content/themes/infocus/images/404.jpg" alt="404 error"/>
<div style = 'height: 5px'></div>
<div style = 'height: 10px'></div><h3>Seems like the page you're looking for isn't here anymore.
<div style = 'height: 10px'></div>Try using the search box or sitemap below.</h3>
<div style = 'height: 10px'></div>
<?php include(TEMPLATEPATH. '/searchform.php'); ?>
<div class="divider top">Top</div>
<?php require(WEBTREATS_INCLUDES . "/sitemap-content-2.php"); ?>
</div> <!-- .post -->
</div><!-- content -->
</div><!-- primary -->
<div id="secondary">
<div class="content">
<?php dynamic_sidebar( 'BlogSidebar' ); ?>
</div><!-- content -->
</div><!-- secondary -->
</div><!-- has_sidebar's body_block -->
<?php get_footer(); ?>
<style type = 'text/css'>
#footer { margin-top: 0px !important; }
</style>
Thanks in advance
Try this,
<?php
get_header();
require(WEBTREATS_INCLUDES . "/var.php");
$teaser_text = get_post_meta($post->ID, 'teaser_text', true);
$teaser_text_custom = get_post_meta($post->ID, 'teaser_text_custom', true);
if ($teaser_text == 'disable' || $header_teaser == 'disable') {
$header_disable = true;
}
?>
<div class="clearboth"></div>
<div id="body_block">
<div class="inner">
<div id="primary">
<div class="content">
<?php if ($header_disable) { ?>
<h1>404 - Not Found</h1>
<?php } ?>
<div <?php post_class() ?> id="post-404">
<?php if ($header_disable) { ?>
<h5>Looks like the page you're looking for isn't here anymore. Try using the search box or sitemap below.</h5>
<?php } ?>
<img src="http://kexino.com/wp-content/themes/infocus/images/404.jpg" alt="404 error"/>
<div style = 'height: 5px'></div>
<div style = 'height: 10px'></div><h3>Seems like the page you're looking for isn't here anymore.
<div style = 'height: 10px'></div>Try using the search box or sitemap below.</h3>
<div style = 'height: 10px'></div>
<?php include(TEMPLATEPATH. '/searchform.php'); ?>
<div class="divider top"><a href="#">Top</a></div>
<?php require(WEBTREATS_INCLUDES . "/sitemap-content-2.php"); ?>
</div> <!-- .post -->
</div><!-- content -->
</div><!-- primary -->
<!-- if you have display issues then add another </div> here -->
<?php get_footer(); ?>
<style type = 'text/css'>
#footer { margin-top: 0px !important; }
</style>
Thanks Elliott.
You must log in to post.