Learn to create new widget area with IT NEW CODE.
This is a Developing Code.
To Create widget area in WordPress Widget page:-
Follow the following steps for Create & Manage Widget area.
Method 1:-
1.To create an area you need to place the following code in your functions.php file.
<?php
if ( function_exists('register_sidebar') ){
register_sidebar(array(
'name' => 'Widget name',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '',
'after_title' => '',
));}
?>
2.Place code where to show widget in WordPress template:-
Now you need to place some code where to tell WordPress where to show the widget.
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Widget name') ) : ?>
<?php endif; ?>
Method 2:-
1.To create an area you need to place the following code in your functions.php file.
2.Place code where to show widget in WordPress template:-
Now, you can see new widget in widgets.
For more Interesting, Useful Article & codes visit IT New Code.
IT NEW CODE always help you with new Developing Code.
This is a Developing Code.
To Create widget area in WordPress Widget page:-
Follow the following steps for Create & Manage Widget area.
Method 1:-
1.To create an area you need to place the following code in your functions.php file.
<?php
if ( function_exists('register_sidebar') ){
register_sidebar(array(
'name' => 'Widget name',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '',
'after_title' => '',
));}
?>
2.Place code where to show widget in WordPress template:-
Now you need to place some code where to tell WordPress where to show the widget.
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Widget name') ) : ?>
<?php endif; ?>
Method 2:-
1.To create an area you need to place the following code in your functions.php file.
<?php
function arphabet_widgets_init() {
register_sidebar( array(
'name' => 'Footer Copyright Center',
'id' => 'footer_copyright_center',
'before_widget' => '<div>',
'after_widget' => '</div>',
'before_title' => '<h2 class="fcc_1_title">',
'after_title' => '</h2>',
) );
}
add_action( 'widgets_init', 'arphabet_widgets_init' );
?>
2.Place code where to show widget in WordPress template:-
Now you need to place some code where to tell WordPress where to show the widget.
<?php if ( is_active_sidebar( 'footer_copyright_center' ) ) : ?>
<div id="primary-sidebar" class="primary-sidebar widget-area" role="complementary">
<?php dynamic_sidebar( 'footer_copyright_center' ); ?>
</div>
<?php endif; ?>
You need just replace id "footer_copyright_center" & name "Footer Copyright Center" in above code.
Now, you can see new widget in widgets.
For more Interesting, Useful Article & codes visit IT New Code.
IT NEW CODE always help you with new Developing Code.
0 comments:
Post a Comment