Home>Support>How to add widget in theme?

How to add widget in theme?

Is their any other way to add a custom widget in themes as I have already seen a resource WordPress theme widget but I am not getting exactly what to do as I have added the code in functions.php and when I am adding code in sidebar.php to make the widget visible it’s not appearing. Any other method to do this?

function wpblog_widget()
{
    register_sidebar(array(
        'name' => __('Primary Sidebar', 'wpb'),
        'id' => 'primary_sidebar', // unique-sidebar-id
        'description' => '',
        'class' => '',
        'before_widget' => '<li id="%1$s" class="widget %2$s">',
        'after_widget' => '</li>',
        'before_title' => '<h2 class="widgettitle">',
        'after_title' => '</h2>',
    ));

}

add_action('widgets_init', 'wpblog_widget');

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 3 years, 8 days ago Andrew Misplon Hi, I Work Here

    Hi Amanda

    Thanks for reaching out.

    We’re, unfortunately, unable to assist with custom development within our free support scope. We’re a small team with limited resources. We can assist with small custom development questions via our premium support channel. Sorry, I don’t have better news.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More