The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Create a different sidebar, how? (2 posts)

  1. hildergarn
    Posted 4 years ago #

    Hi. At this moment I got a sidebar displaying the default widgets (search, categories, archives, etc.), but If I want to create a different sidebar showing advertisement only, how should I proceed for that?


  2. zex2911
    Posted 4 years ago #

    you can either add another widget to that sidebar, or register another sidebar in your functions.php
    This is how to register sidebar:

    //Widget-enabled sidebar
    if ( function_exists('register_sidebar') )
            'before_widget' => '<div class="sidebar1">',
            'after_widget' => '</div>',
            'before_title' => '<div class="title">',
            'after_title' => '</div>',

    and this is what should be in your sidebar.php

    <div class="sidebar">
    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar('sidebar1') ) : ?>
    <?php endif; ?>

    and you call it in your page.php, single.php, or wherever you want it

    <?php get_sidebar()?>

Topic Closed

This topic has been closed to new replies.

About this Topic