- This topic is empty.
-
AuthorPosts
-
March 23, 2012 at 12:36 am #37301
shamai
Memberso I’m new to wordpress and I’m currently reading digging into wordpress
I have been waiting for a certain topic to come up in the book, but it hasn’t so i have come here askhow do you make menus?
normally in a static site I make nav>ul>li and i style the li’s with css accordingly
but I’m guessing its suppose to be dynamic using wordpress functions to pull in the pages or categories depending on user preferences.
im guessing a while loop is needed to search through all your pages and then display them and style them.
but I can’t find any loops about pages or categories…only postsor is the navbar supposed to be static links? I mean I guess I wouldn’t want every category listed there
how do people normally do this?
March 23, 2012 at 5:08 am #99744kobylecki
MemberI usually use function
wp_list_pages()
Read a docs: http://codex.wordpress.org/Function_Reference/wp_list_pages
And my use case:
You can include only some pages or exclude some of them. Sort specific by order from administration or set by hand. Any you can think of.
March 23, 2012 at 9:14 am #99759shamai
Membercool!
thanks!i am looking at websites and seeing how they make them. I see some websites mix and match categories and tags in their menu
would that be listing categories and omitting some and listing tags and omitting some?
March 23, 2012 at 9:57 am #99762shamai
Memberaha
i have discovered the new wp 3.0 menu system
but it doesn’t seem to include the option for tagsMarch 23, 2012 at 6:20 pm #99810Kermet
Memberhttp://codex.wordpress.org/Function_Reference/wp_nav_menu
You create the menu in the backend, filling it with whatever you need, then you print to the frontend with wp_nav_menu(array(‘menu’ => ‘mymenuname’));
You really don’t need more than that for 99% of sites…
March 24, 2012 at 11:09 pm #99893shamai
MemberI’m going to have to figure out how to style that
March 25, 2012 at 4:51 pm #99919JoshWhite
MemberWhat I’d recommend is copy TwentyTen or TwentyEleven themes… both of those have a pretty straight forward method. Grab the code out of the header that looks like this:
'menu-header', 'theme_location' => 'primary' ) ); ?>
Then the CSS will be this block here:
#main-nav .menu-header,
div.menu {
}
#main-nav .menu-header ul,
div.menu ul {
}
#main-nav .menu-header li,
div.menu li {
}
/* main menu links */
#main-nav a {
}
#main-nav a:hover {
}
#main-nav ul ul {
}
#main-nav ul ul li {
}
#main-nav ul ul ul {
}
/* sub menu links */
#main-nav ul ul a {
}
/* Sub menu hover */
#main-nav ul ul :hover > a {
}
#main-nav ul li:hover > ul {
}
That will at least get you into working with them dynamically through the dashboard. Don’t stop learning there there, but that will begin to give you a sense of adding additional menus, drop downs, sub layers, etc
March 26, 2012 at 11:02 am #99941shamai
Memberthanks!
im gonna play aroundMarch 26, 2012 at 12:57 pm #99955TheDoc
MemberI like the menu feature when it came out, but since then I’ve found it to simply get in the way, especially on larger websites.
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.