Advertisement
arnabkumar

wp_theme_develop_note

Mar 22nd, 2014
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.71 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4.  
  5. /* WordPress 3.0 Menu Editor ********************************************/
  6.  
  7.     // add menu support and fallback menu if menu doesn't exist
  8.    
  9.     function wpj_register_menu() {
  10.         if (function_exists('register_nav_menu')) {
  11.             register_nav_menu( 'wpj-main-menu', __( 'Main Menu', 'brightpage' ) );
  12.         }
  13.     }
  14.    
  15.    
  16.     /*register_nav_menu (wpj-main-menu/footer-menu) ta menu register korar jonno theme locetion
  17.     theke and 2nd ta (Main Menu/Footer Menu) menur nam anar jonno*/
  18.    
  19.     register_nav_menu( 'footer-menu', __( 'Footer Menu', 'brightpage' ) );
  20.    
  21.     add_action('init', 'wpj_register_menu');
  22.    
  23.     /* menu fallback code */
  24.     function wpj_default_menu() {
  25.         echo '<ul id="dropmenu">';
  26.         if ('page' != get_option('show_on_front')) {
  27.             echo '<li><a href="'. home_url() . '/">Home</a></li>';
  28.         }
  29.         wp_list_pages('title_li=');
  30.         echo '</ul>';
  31.     }
  32.  
  33. /*end menu function */
  34.  
  35.  
  36. /* menu Header e call korte*/
  37.  
  38. <?php
  39.                 if (function_exists('wp_nav_menu')) {
  40.                     wp_nav_menu(array('theme_location' => 'wpj-main-menu', 'menu_id' => 'nav', 'fallback_cb' => 'wpj_default_menu'));
  41.                 }
  42.                 else {
  43.                     wpj_default_menu();
  44.                 }
  45.                 ?>
  46.  
  47. /* menu id r jaygay class thakle menu_class hobe */
  48. /* jodi id or class na thake tahole sudhu theme location hobe
  49. mane je name menu register kora hobe
  50.  
  51. */
  52.  
  53. <?php wp_nav_menu( array( 'theme_location' => 'wpj-main-menu') ); ?>
  54. /* footer menu clall korar jonno */
  55.  
  56. <?php wp_nav_menu( array( 'theme_location' => 'footer-menu', 'menu_id' => 'footer_menu') ); ?>
  57.  
  58.  
  59. /* Register sidebars and widgetized areas ********************************************/
  60. function sanchari_widgets() {
  61.     register_sidebar( array(
  62.         'name'          => __( 'Promo1', 'wp_sourse' ),/*This name is unique
  63.                                                         to the widget and appears on
  64.                                                         the Widgets page on the Dashboard;
  65.                                                         this name is helpful if you register
  66.                                                         several widgetized areas on your site. */
  67.        
  68.  
  69.         'id'            => 'promo1',/*This is the unique ID given to the widget. */
  70.         'description' => __( โ€˜The primary widget areaโ€™),/* This is a text description
  71.                                                             of the widget. The text appears on
  72.                                                             the Widgets page on the Dashboard.
  73.                                                             This is optional.
  74.                                                             */
  75.        
  76.         'before_widget' => '<div class="single_promo promo1">',/* */
  77.         'after_widget'  => '</div>',/* */
  78.         'before_title'  => '<h2>',/* */
  79.         'after_title'   => '</h2>',/* */
  80.     ) );
  81.    
  82.  
  83. }
  84. add_action( 'widgets_init', 'sanchari_widgets' );
  85.  
  86. /* widgetized call two types
  87. 1. *****Normal****
  88.  
  89. <?php dynamic_sidebar('sidebar_id'); ?>
  90.  
  91. 2.*******for fallback data********
  92.  
  93. <?php if ( ! dynamic_sidebar('sidebar_id') ) : ?>
  94.     YOUR DEFAULT DATA
  95. <?php endif; ?>
  96.    
  97.  
  98.  
  99.  
  100.  */
  101.  
  102. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement