Use page id in wp nav menu li a - wordpress

I make a wordpress menu in my wordpress theme. I want to make it a one-page theme i.e. If the theme have Home,Services,Our Team,Work,Contracts menu.
I want to make such that If i click on services. The page will go services area of the same page. I know that in HTML Template this is done using id of that area i.e <li>Services</li>.
But I want to use it in wordpress theme. But I don't know how I can use it.
The menu dynamic code of my header php is below.
<div class="header_menu">
<?php wp_nav_menu( array( 'theme_location' => 'header-menu', 'menu_id' => 'nav' ) ); ?>
</div>

You've tried to use an anchor?
You have 2 solution at this problem:
1) Manage your wp menu to create custom link with anchor;
2) Try to use jQuery to modify structure of menu, after page loading.

Related

Wordpress: How to select a menu for mobile Woocommerce pages?

I'm trying to put a different menu on the Woocommerce pages of my Wordpress site. An extra condition is that this menu only has to be displayed if the site is visited by an mobile device. I've tried the following code in my header.php file, but it didn't work out. Anyone who can help me?
if ( wp_is_mobile() && ($pagename == 'page-name') ) {
wp_nav_menu( array( 'menu' => 'mobile-menu' ) );
}
First you need to register the menu then you need to assign menu items to it.
you can verify the following link
mobile menu

Customize header and footer in WordPress theme

I am currently working on a WordPress site with hardcoded values in the header and footer. I'd like to make both the header and footer editable from within the WP Admin, but am not sure the best route. Any thoughts on best practices?
Admin/Appearance/Widgets.
I recommend you create a widget that allows the footer to be edited.
This scenario is vastly used when web-developers are handing over the freedom for editing to their clients. This minimizes the risk of faults while editing.
If you have menus in header and footer then, you can create a menu in apperance->menus in wp-admin and call it in footer by their ID (theme-location).
<?php wp_nav_menu( array( 'theme_location' => 'header-menu' ) ); ?>
Any other text can be printed in header and footer by created widgets as answered above..

create own wordpress theme (tewnty ten as base)

i have to create a customized wordpress theme.
i still don't how it should look like, so viewed the twenty ten theme files to figured out what i could customize.
so i searched for the menu build function in the header.php file and found this
<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
but i cant figure out what this function does...where is written how the menu is created with html tags like <ul>, <li> and so on...
i wan't to edit the html code!
regards,
peter
Check out the documentation for wp_nav_menu in the codex. It's a menu system added to WordPress back at version 2.9 (I believe). If you navigate in your dashboard to Appearance -> Menus, you can customize it through an interface. In Twenty Ten, the fallback is wp_page_menu, which displays a list of your pages. Should you prefer to build yours by hand and hard code it into the theme (not advisable, but possible) just delete the relevant code and replace it with your own HTML.
My adviice is to look into the Menu interface, create a menu, assign it to the theme position 'primary', and go from there with a properly configurable and WP-driven menu.

Add custom menu to drupal 7

I have added a new menu to my drupal structure and I want to display this menu, under the main menu in my drupal theme.
I am not sure how to add a new menu and display it in my theme though?
I tried adding this to my page.tpl file:
<?php print theme('links', array('links' => menu_navigation_links('menu-download-categorys'), 'attributes' => array('class'=> array('links', 'downloads-menu')) ));?>
i use the following in drupal 7
<?php if (!empty($page['superfish_menu'])){ ?>
<div id="superfish"><?php print render($page['superfish_menu']); ?></div>
<?php } ?>
As an alternative, and particularly for a site you'll be handing off, is to manage your menus through the Drupal admin UI. You can add any Drupal Internal URL via the menu configuration UI: /admin/structure/menu/manage/main-menu for "Main Menu" and thus you wont have to fire up your ssh/file editor when you want to make further modifications to this menu.

How to call different different menus at same page in WordPress?

I am using WordPress 3.0.4. I have created approximate 10 page through admin from
Dashboard->Pages->Add New->Update
After that I have created two menu from Dashboard->Appearance->Menu->
The first menu name is header-top-navigation. Second menu name is header-bottom-navigation
After that check the page and add to menu which I need in top header (header-top-navigation) and other pages added to (header-bottom-navigation).
How to call these different menu on frontend?
Use wp_nav_menu() in your theme files.
To insert the menu header-top-navigation
<?php wp_nav_menu( array('menu' => 'header-top-navigation' )); ?>

Resources