• Resolved billybob71a

    (@billybob71a)


    Hi,

    I was wondering is it possible to add a side bar to the page?

    I have a widget to put a login/logout widget in a sidebar, but there is no place to add a side bar.

    Thanks.

    Peter

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Theme Author Anders Norén

    (@anlino)

    Hi @billybob71a,

    No, Hitchcock doesn’t have any widget areas, unfortunately.

    — Anders

    Thread Starter billybob71a

    (@billybob71a)

    Hi Anders,

    Ok, thanks for your reply.
    I am a little bit new to wordpress. Do you know if it is possible to add widget areas?

    Peter

    Theme Author Anders Norén

    (@anlino)

    @billybob71a It’s possible if you create a child theme, register a widget area in the child theme functions.php (using register_sidebar()) and output it in index.php and singular.php, but you would have to restructure a lot of stuff to make it work with the layout.

    Thread Starter billybob71a

    (@billybob71a)

    Ok, in my functions.php, I have:
    add_action( ‘widgets_init’, ‘petery_sidebar’ );
    function petery_sidebar() {
    register_sidebar( array(
    ‘name’ => __( ‘Sidebar name’, ‘theme_hitchcock’ ),
    ‘id’ => ‘sidebar-1’,
    ‘description’ => ”,
    ‘before_widget’ => ”,
    ‘after_widget’ => ”,
    ‘before_title’ => ”,
    ‘after_title’ => ”,
    ) );
    }

    In index.php and singular.php , I have
    <?php get_header(); ?>
    <?php if ( is_active_sidebar( ‘sidebar-1’ ) ) : ?>
    <ul id=”sidebar”>
    <?php dynamic_sidebar( ‘sidebar-1’ ); ?>

    <?php endif; ?>

    But the sidebar does not appear.

    Theme Author Anders Norén

    (@anlino)

    @billybob71a Does the widget area appear in Appearance → Widgets, and if it does, have you added any widgets to it?

    Thread Starter billybob71a

    (@billybob71a)

    Hi Anders,
    Yes, it does.
    Site is “https://www.visorsourcing.com&#8221;
    I think I am pretty close to adding the widget to where I want it.
    I added the following to functions.php. The “login/logout register” link appears in the “.content” area, but I want it to appear just below the Navigation bar. Do you know if that is possible?

    //Petery code, the following will add a widgetized sidebar , maybe
    function wpsites_before_post_widget( $content ) {
    if ( is_singular( array( ‘post’, ‘page’ ) ) && is_active_sidebar( ‘sidebar-1’ ) && is_main_query() ) { ?>

    <div id=”myprefix-widget-area-wrap”><?php
    dynamic_sidebar(‘sidebar-1’); ?>
    </div>
    <?php
    }
    return $content;
    }
    add_filter( ‘the_content’, ‘wpsites_before_post_widget’ );
    ?>

    Hi Billy,

    did you managed to get the sidebar widget working?

    And I have another question if you don’t mind, what did you use to show the dropdown language menu? I’m using Polylang but I’m not able to show the language switcher widget.

    Thank you

    Thread Starter billybob71a

    (@billybob71a)

    I did not manage to get the sidebar widget working as I wanted it. It still displays within the class “post-container”. For the language switcher go to “Appearance” > “Menus”, select the menu that you want edit and put a check on “Language Switcher” and then “Add to Menu”.

    Peter

    I tried that before but there is no option “Language Switcher” to check as you can see in the following screenshot.

    Jo?o

    Ok, nevermind.

    I was looking for it in “Appearence -> Customize -> Menus” instead of “Appearance -> Menus”.

    Thanks, that worked.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘adding a sidebar widget’ is closed to new replies.