Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* 1. menu simple function e *//*main-menu hare unic you can change it*//* Main Menu hare menu name display*/
- register_nav_menu( 'main-menu', __( 'Main Menu', 'arnab' ) );
- /* menu call korte *//*html e ul id/class="nav" thakleo menu id/class nav dile hobe */
- /* nav poriborte onno class/id thakte pare */
- <?php wp_nav_menu( array( 'theme_location' => 'main-menu', 'menu_id' => 'nav') ); ?>
- /* 2. fallback menu register e register *//* 1st simple menu hobe then fallback code */
- register_nav_menu( 'main-menu', __( 'Main Menu', 'arnab' ) );
- /* menu fallback code */
- function wpj_default_menu() {
- echo '<ul id="nav">'; /* ul id r bodole div/class id hote pare html jamon thakbe */
- if ('page' != get_option('show_on_front')) {
- echo '<li><a href="'. home_url() . '/">Home</a></li>';
- }
- wp_list_pages('title_li=');
- echo '</ul>';
- }
- /* menu call korte*//*wp_nav_menu hare wordpress function*/
- /* menu id r jaygay class thakle menu_class hobe */
- /* jodi id or class na thake tahole sudhu theme location hobe
- mane je name menu register kora hobe*/
- <?php
- if (function_exists('wp_nav_menu')) {
- wp_nav_menu(array('theme_location' => 'main-menu', 'menu_id' => 'nav', 'fallback_cb' => 'wpj_default_menu'));
- }
- else {
- wpj_default_menu();
- }
- ?>
- /* menu extra option from codex */
- Usage
- <?php wp_nav_menu( $args ); ?>
- Usage (Showing Default Values)
- <?php
- $defaults = array(
- 'theme_location' => '',
- 'menu' => '',
- 'container' => 'div',
- 'container_class' => '',
- 'container_id' => '',
- 'menu_class' => 'menu',
- 'menu_id' => '',
- 'echo' => true,
- 'fallback_cb' => 'wp_page_menu',
- 'before' => '',
- 'after' => '',
- 'link_before' => '',
- 'link_after' => '',
- 'items_wrap' => '<ul id="%1$s" class="%2$s">%3$s</ul>',
- 'depth' => 0,
- 'walker' => ''
- );
- wp_nav_menu( $defaults );
- ?>
- /* end menu extra option from codex */
- /* Register sidebars and widgetized areas ********************************************/
- function sanchari_widgets() {
- register_sidebar( array(
- 'name' => __( 'Promo1', 'wp_sourse' ),/*This name is unique
- to the widget and appears on
- the Widgets page on the Dashboard;
- this name is helpful if you register
- several widgetized areas on your site. */
- 'id' => 'promo1',/*This is the unique ID given to the widget. */
- 'description' => __( ‘The primary widget area’),/* This is a text description
- of the widget. The text appears on
- the Widgets page on the Dashboard.
- This is optional.
- */
- 'before_widget' => '<div class="single_promo promo1">',/* */
- 'after_widget' => '</div>',/* */
- 'before_title' => '<h2>',/* */
- 'after_title' => '</h2>',/* */
- ) );
- }
- add_action( 'widgets_init', 'sanchari_widgets' );
- /* widgetized call two types */
- /*1. *****Normal**** */
- <?php dynamic_sidebar('sidebar_id'); ?>
- /* 2.*******for fallback data******** */
- <?php if ( ! dynamic_sidebar('sidebar_id') ) : ?>
- YOUR DEFAULT DATA
- <?php endif; ?>
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement