Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php function to show nav menu with example

// 1. registering the menus
    function register_my_menu() {
      register_nav_menu('header-menu',__( 'Header Menu' ));
    }
    add_action( 'init', 'register_my_menu' );

    // adding two menus
    function register_my_menus() {
      register_nav_menus(
        array(
          'header-menu' => __( 'Header Menu' ),
          'extra-menu' => __( 'Extra Menu' )
        )
      );
    }
    add_action( 'init', 'register_my_menus' );

// 2. Displaying the menus in theme
	<?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>
  		// displaying extra menu in certain page with certain class
  			wp_nav_menu( array( 'theme_location' => 'extra-menu', 'container_class' => 'my_extra_menu_class' ) );
Comment

PREVIOUS NEXT
Code Example
Php :: fetch data from database withour restarting console php 
Php :: javascript,php error 
Php :: laravel creating_table_name 
Php :: laravel 9 remove public from url 
Php :: array_key_first not works 
Php :: undefined type excel 
Php :: add backslash to path wordpress 
Php :: verify that a valid login cookie was sent in order to do special things for that logged-in 
Php :: next previous post link 
Php :: afosto/yaac error parsing certificate request 
Php :: laravel where search like with space 
Php :: laravel softdeletes not working giving empty data 
Php :: delete request php-salesforce-rest-api 
Php :: update query in laravel eloquent 
Php :: plesk change php version 
Php :: php if condition 
Php :: php cgi file not fount linux 
Php :: config in php 
Php :: laravel api get controller 
Php :: simple using mdb with php script PDO 
Php :: How to download file with laravel 
Php :: $user-id show 0 in blade laravel 8 
Php :: find_by model fuelphp 
Php :: php cors error 
Php :: php calculate age as float 
Php :: Same Taxonomy Add Multiple Post Type 
Php :: acf blocks register block with enqueue script 
Php :: import csv in laravel 
Php :: find only selected columns 
Php :: cmb2-repeater video show single page with wordpress 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =