• Hi all

    I have a onepager theme. (no common theme made from the scratch / previous developer gone)
    The older post go into an Archive page but I would like to have a sidebar there. How can I add a sidebar or create a new template. Every tutorial I saw was assuming there is some basic sidebar in the theme. It is here not the case at all. there is no widget area but the footer.

    Do you have any links / tuturials or tipps for me how I can create a sidebar on the right?
    Can I take a template from another theme and add it to the current theme?

    thanks for the help in advance

    Marc

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Loop76,

    Perhaps create a child theme and then add that sidebar to the child theme?

    (1) Here’s a link to the training documentation about child themes: https://make.wordpress.org/training/handbook/theme-school/child-themes/

    (2) Within the child theme files, you might use this documentation about adding a sidebar:

    https://codex.wordpress.org/Sidebars

    Thread Starter Loop76

    (@loop76)

    Hey Liam, thank you for your reply

    so I made it but I don’t know if I covered everything.
    I used the sidebar creator and copid this in the functions.php (do I repeat myself here with the footer?):

    function theme_widget_init() {
    register_sidebar( array(
    ‘id’ => ‘footer-info’,
    ‘name’ => __( ‘Footer Info’, ‘mywebsite‘ ),
    ‘before_widget’ => ‘<div class=”%2$s” id=”%1$s”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h3>’,
    ‘after_title’ => ‘</h3>’
    ) );
    }

    // Register new Sidebars
    function custom_sidebar() {

    $args = array(
    ‘id’ => ‘main-sidebar’,
    ‘name’ => __( ‘Main Widget Area’, ‘text_domain’ ),
    ‘description’ => __( ‘Appears on posts and pages in the sidebar.’, ‘text_domain’ ),
    ‘before_title’ => ‘<h2 class=”widgettitle”>’,
    ‘after_title’ => ‘</h2>’,
    ‘before_widget’ => ‘<li id=”%1$s” class=”widget %2$s”>’,
    ‘after_widget’ => ‘‘,
    );
    register_sidebar( $args );

    Now Sidebar appears in the widget area in the dashboard.
    The question is…is this all to it?
    also I Widget Name appears a h1 headline above the sidebar. How can I style or hide this?

    thanks in advance

    • This reply was modified 7 years, 8 months ago by Loop76.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding a Sidebar (creating a template)’ is closed to new replies.