Editing the 404 Error Page

resolved (21 posts) (3 voices)

  1. 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

    Posted 1 year ago #
  2. Elliott
    Support

    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.

    Posted 1 year ago #
  3. dediger
    Member

    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

    Posted 1 year ago #
  4. Elliott
    Support

    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.

    Posted 1 year ago #
  5. 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.

    Posted 1 year ago #
  6. Elliott
    Support

    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.

    Posted 1 year ago #
  7. Works perfectly. Thank you so much.

    Posted 1 year ago #
  8. Elliott
    Support

    Your welcome KEXINO, let us know if you need anything else.

    Posted 1 year ago #
  9. 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

    Posted 1 year ago #
  10. Elliott
    Support

    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.

    Posted 1 year ago #
  11. 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.

    Posted 1 year ago #
  12. Elliott
    Support

    If possible then set us up with a link to your site so we can take a closer look.

    Posted 1 year ago #
  13. kexino.com

    I've attached the current 404.php file as well.

    Thanks in advance.

    Posted 1 year ago #
  14. Didn't attach the first time around. Trying again.

    Posted 1 year ago #
  15. 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.

    Posted 1 year ago #
  16. Elliott
    Support

    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.

    Posted 1 year ago #
  17. Thank you, that worked.

    Now, what about my problem in making the page full-width - i.e. without any sidebar?

    Posted 1 year ago #
  18. Elliott
    Support

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

    Posted 1 year ago #
  19. 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

    Posted 1 year ago #
  20. Elliott
    Support

    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>
    Posted 1 year ago #
  21. Thanks Elliott.

    Posted 1 year ago #

Reply

You must log in to post.

Construct WordPress Theme
Construct wordpress theme
Myriad WordPress Theme
Myriad wordpress theme
Method WordPress Theme
Method wordpress theme
Fusion WordPress Theme
Fusion wordpress theme
Elegance WordPress Theme
Elegance wordpress theme
Echelon WordPress Theme
Echelon wordpress theme
Dejavu WordPress Theme
Dejavu wordpress theme
Modular WordPress Theme
Modular wordpress theme