Add custom menu to drupal 7 - drupal

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.

Related

Use page id in wp nav menu li a

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.

how do i add different custom right sidebars with different widths and content on different pages in wordpress?

i everyone i have afew pages in wordpress that i need different custom right sidebars on with different css styles. for example i would like my homepage right sidebar to be a set width say 100px and displaying specific content and id like to have my special offers page with a right sidebar thats a different width say 230px displaying different content like widgets etc...
to my understanding this should be able to be achieved by creating custom sidebars by registering them with a wordpress function and then creating a custom sidebar template php file with a different css class for the sidebar. and then calling the new custom sidebar template file inside of a custom page template file being applied to a target page in wordpress so that the page loads the custom sidebar template instead of the normal sidebar template with a new css class that can be modified to achieve different sidebar styles for different pages. so i created the following custom sidebar template and called it customrightsidebar.php
<div id="sidebar3"><div class="sidebar3"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('customright-sidebar') ) : ?><div class="customright-sidebar"><h4>Recent Posts</h4><ul><?php wp_get_archives('type=postbypost&limit=5'); ?> </ul></div><?php endif; ?></div> <br style="clear:both"></div>
i then registered a new custom sidebar using this function
register_sidebar(array('name'=>'customright-sidebar','before_widget' => '<div class="customright-sidebar">','after_widget' => '</div>','before_title' => '<h4>','after_title' => '</h4>',));
and here is the custom page template that is calling the custom sidebar template
<?php get_header(); ?><div id="breadcrumb"><?php breadcrumbs(); ?></div>
<?php include(TEMPLATEPATH."/customrightsidebar.php");?>
<div id="kontenutama"> <div class="postingan2"><?php if (have_posts()) : while (have_posts()) : the_post(); ?><h2><?php the_title(); ?></h2><?php the_content(); ?><?php endwhile; else: ?> <p><?php _e('Sorry, no posts matched your criteria.'); ?></p><?php endif; ?><br style="clear:both;"></div></div>
<br style="clear:both"><div style="clear:both"></div><?php get_footer()?>
i successfully have a custom right sidebar that appears in my wordpress admin panel and i can apply widgets to it in the widgets section of my admin panel i can also see it appear in the custom sidebar dropdown selection menu in my wordpress pages where you would specify your new custom sidebars to overwrite the old ones. you can see a screenshot of the sidebar selection boxes in my theme by visiting this url
http://test.smartphonesource.org/sidebars.png
and normally by selecting it it would overwrite the default sidebars on the page
i have been able to get the custom sidebar template to load with the custom class on the page and ive been able to edit the css but the actual custom sidebar itself with its widgets isnt appearing or overwriting anything even though ive selected it to overwrite the right sidebar of the current page in the custom sidebars selection box
im not sure where to go from here or if there is a different way to do this i think somewhere the customsidebar isnt overwriting the default right sidebar when its been selected in the custom sidebar selection box on my pages im new to wordpress and php. ive been able to use the customright-sidebar on my videos page for testing and it successfully overwrote the right sidebar and worked but it was running this default right sidebar template
<div id="sidebar2"><div class="sidebar2"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar Right') ) : ?><div class="left-sidebar"><h4>Recent Posts</h4><ul><?php wp_get_archives('type=postbypost&limit=5'); ?> </ul></div><?php endif; ?></div> <br style="clear:both"></div>
anyhelp would be greatly appreciated figuring this out =) you can see the homepage of the site here that im using to learn wordpress and from there you can navigate to the videos and special offers page that im tearing apart to get a better idea of what im trying to do with the sidebars
http://test.smartphonesource.org
First of all, your website looks really awesome:) And to fix this did you make sure that your page is only grabbing the new sidebar code only?
i managed to fix the page issue im not sure what was wrong but it suddenly started working with the same code i know i cleared my cache so maybe that was affecting it or preventing the new changes from appearing sometimes if i dont clear the cache after i upload new images they wont display for me

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.

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' )); ?>

wordpress 3: create navigation menu for a custom post type

Just playing around with Wordpress 3.0 for the first time. I've installed the Custom Post Type UI plugin, and have created a custom post type: "composers".
How do I go about creating a navigation menu for all the composers? Ideally, I'd like a static page entitled 'composers' which has a nav menu of all the individual composers.
In the Appearance -> Menus page, I can create a menu and assign composers individually to it, but what do I need to do to just add the entire collection of composers to a menu, so that it updates when I add a new composer? Surely I don't have to add them all manually?
What you're trying to do might be better achieved as a plugin, or a little editing in your theme file, something along the lines of;
$composers = new WP_Query('post_type=composers');
if ($composers->have_posts():
?>
<ul class="composer-nav">
<?php while ($composers->have_posts()): $composers->the_post(); ?>
<li>
<?php the_title(); ?>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
I know the idea behind custom menus was to try and avoid the need for plugins or theme editing, but I think it was truly designed for users to be able to pick and choose exactly what they wanted, rather than automatically listing items (just my opinion).

Resources