WordPress.org

Ready to get started?Download WordPress

Forums

Twenty Eleven
[resolved] Display sidebar and widgets on 404 page (6 posts)

  1. Guido
    Member
    Posted 2 years ago #

    Hi,

    On the 404 page are some preset widgets displayed, below the searchform. I don't want these widgets so I removed them from 404.php.

    My footer widgets are not displayed on 404 page, how can I display my widgets in footer?

    And even more important, how can I display sidebar on 404 page? I added 'get_sidebar' in 404.php but it's displayed below the preset widgets now. So I changed width in css file, but without result..

    Please help me.

    Guido

    http://wordpress.org/extend/themes/twentyeleven/

  2. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    look into footer.php, why the footer widgets are not shown in the 404 page.

    the rest is a pure css formatting issue; you will need to create a few new styles in style.css of the child theme, to correct the .error404 styles from the Twenty Eleven parent theme.

    this will depend on your theme layout option settings.

    please post a link to your site for further suggestions.

  3. Guido
    Member
    Posted 2 years ago #

    Thanks.

    I removed line 'if ( ! is_404() )' from footer.php + all data about error404 widgets from CSS file, so my widgets are displayed on 404 page now.

    Alignment of 404 message/searchform and sidebar is still not correct, even when I delete all data about searchform + 404 page from CSS file... So tips are welcome :-).

    I don't have a weblink right now, my site's running local.

  4. Guido
    Member
    Posted 2 years ago #

    Removed '<div class="entry-content">' from footer.php and added '<?php get_sidebar(); ?>' in footer.php.
    Besides this fooled around with css a little and it's done.

    I now have 404 page with my own footer widgets and sidebar!

  5. Johmai
    Member
    Posted 1 year ago #

    And even more important, how can I display sidebar on 404 page?

    I'm also struggling to do this.

    @alchymyth, my child theme for twenty eleven uses 2 sidebars which are brought about by code in functions.php.
    How do I include/call them?
    This: <?php get_sidebar(); ?> does nothing...

    And because I cannot edit the 404.php as I would edit a post, it's not possible to simply specify to use "sidebar template" - which would ordinarily secure 2 sidebars in place.

    Please help.

  6. maryhellen
    Member
    Posted 1 year ago #

    I had same problem and I've resolved in this way:
    in the 404.php insert this code where you want to make display your sidebar:

    <?php
     // Custom widget Area Start
     if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Left sidebar - 2') ) : ?>
    <?php endif;
    // Custom widget Area End
    ?>

    Substitute 'Leftsidebar- 2' with your sidebar name (You'll find it in the functions.php).

    Hope it helps.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic