Latest Post

How to add a new widget area to a WordPress theme

How to add a new widget area to a WordPress theme

How to add a new widget area to a WordPress theme


This code use for you can add new widget your website.


Step-1


<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('header-sidebar') ) : endif; ?>

step-2 


<?php
function smallenvelop_widgets_init() {
    register_sidebar( array(
        'name' => __( 'Header Sidebar', 'smallenvelop' ),
        'id' => 'header-sidebar',
        'before_widget' => '<div>',
        'after_widget' => '</div>',
        'before_title' => '<h1>',
        'after_title' => '</h1>',
    ) );
}

add_action( 'widgets_init', 'smallenvelop_widgets_init' );

No comments