Friday, September 5, 2014

Widget Creation in Wordpress

// Sidebar Footer Column in functions.php


register_sidebar( array(
'id' => 'Sidebar Footer smile-1',
'name' => __( 'Sidebar Footer smile', 'foundation' ),
'description' => __( 'This sidebar is located in column Smile of your theme footer.', 'foundation' ),
'before_widget' => '<div class="fl_left clear">',
'after_widget' => '</div>',
'before_title' => '<h5>',
'after_title' => '</h5>',
) );





// Call this widget in footer.php

<div class="wrapper row4">
  <div class="rnd">
    <div id="footer" class="clear">
      <!-- ####################################################################################################### -->
       <?php if ( dynamic_sidebar('Sidebar Footer smile') ) : elseif( current_user_can( 'edit_theme_options' ) ) : ?>

<h5><?php _e( 'No widgets found.', 'foundaton' ); ?></h5>
<p><?php printf( __( 'It seems you don\'t have any widgets in your sidebar! Would you like to %s now?', 'foundation' ), '<a href=" '. get_admin_url( '', 'widgets.php' ) .' ">populate your sidebar</a>' ); ?></p>
<?php endif; ?>
   
      <!-- ####################################################################################################### -->
    </div>
  </div>
</div>

No comments: