Tagged: , ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #22575

    Hi,

    I would like to add the pages widget (or preferably a custom menu widget) to the main content area of the error404.php page (instead, or preferably, in addition to the avia combo widget). What would I need to add to error404.php to achieve this please?

    #116219

    Hi!

    You can add the widget into the “Displayed Everywhere” widget area and use: http://wordpress.org/extend/plugins/widget-logic/ and the is_404() conditional to display the widget on the 404 page only.

    Best regards,

    Peter

    #116220

    Hi Dude,

    I already have the pages widget added to the sidebar, but I wanted to add it in to the main content area of the error404.php page, not a sidebar, just below the search box that appears and above where the avia combo widget appears. I have looked at the error404.php page and want the widget to appear above or instead of the code below:

    <h3 class=''><?php _e('Feel like browsing some posts instead?', 'avia_framework'); ?></h3>

    <?php
    the_widget('avia_combo_widget', 'error404widget', array('widget_id'=>'404',
    'before_widget' => '<div class="widget avia_combo_widget">',
    'after_widget' => '</div>',
    'before_title' => '<h3 class="widgettitle">',
    'after_title' => '</h3>'
    ));
    ?>

    I tried to change the widget name in the code above to the pages_widget, but it didn’t work!

    #116222

    Hi,

    Open includes error404.php and find this code

    <p><strong><?php _e('Nothing Found', 'avia_framework'); ?></strong><br/>

    Place this code at the bottom.

    <h3 class=''><?php _e('Feel like browsing some posts instead?', 'avia_framework'); ?></h3>

    <?php
    the_widget('avia_combo_widget', 'error404widget', array('widget_id'=>'404',
    'before_widget' => '<div class="widget avia_combo_widget">',
    'after_widget' => '</div>',
    'before_title' => '<h3 class="widgettitle">',
    'after_title' => '</h3>'
    ));
    ?>

    Remove the same code below. Try to remove browser cache the reload the page.

    Regards,

    Ismael

    #116223

    Sorry Ismael, am I missing something? You’ve just given me the identical code that already exists on the error404.php and that I referenced in my 2nd post!!

    That code displays the combo widget in the main content area of the 404 page. I want to add a custom menu or pages widget above this (or actually even above the search bar that appears above the combo widget)

    Thanks,

    Matt

    #116224

    Hi,

    Sorry my bad. Please do this instead. On functions.php place this code at the very bottom.

    function new_widgets_init() {

    register_sidebar( array(
    'name' => '404 Widget',
    'id' => '404_sidebar',
    'before_widget' => '<div>',
    'after_widget' => '</div>',
    'before_title' => '<h2 class="rounded">',
    'after_title' => '</h2>',
    ) );
    }
    add_action( 'widgets_init', 'new_widgets_init' );

    Now edit error404.php and find this code

    <h3 class=''><?php _e('Feel like browsing some posts instead?', 'avia_framework'); ?></h3>

    Below add this code

    <?php
    if ( dynamic_sidebar('404_sidebar') ) :
    else :
    ?>
    <?php endif; ?>

    Go to Appearance > Widget and add some widgets on 404 Widget Area.

    Regards,

    Ismael

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Add widget to error404.php page’ is closed to new replies.