Add Custom Widget Area in Wordpress

First you’ll want to add this code to your active theme’s function.php file. This code is used to register the custom widget area and create it on the backend.

// Custom widget area.
 register_sidebar( array(
    'name' => __( 'Custom Widget Area'),
    'id' => 'custom-widget-area',
    'description' => __( 'An optional custom widget area for your site', 'twentyten' ),
    'before_widget' => '<li id="%1$s" class="widget-container %2$s">',
    'after_widget' => "</li>",
    'before_title' => '<h3 class="widget-title">',
    'after_title' => '</h3>',
) );





Next you’ll want to add this code to whichever page template you’d like the widget area to show up on. This code is used to display the custom widget area in any location you choose within your theme’s files.


<?php
// Custom widget area start
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Custom Widget Area') ) : ?>
<?php endif; ?>

Comments

Popular posts from this blog

Create New Project in Laravel

How to Get Access of Database of Dynamic Site Without cPanel Details

How to Create Secondary Menu in Squarespace