Over the past couple days i've moved my entire portfolio from static HTML pages to wordpress pages. for the moment i'm using one template for all of them. With static HTML I was using 1 template per project, which let me show only the current project's pages in the side menu, and the list of projects in the top menu. (example). With Using 1 template, it's tempting to use <?php wp_list_pages() ?> to generate the side menu. except that i have A LOT of pages. 38 at last count. So I want the side menu to only show the list of projects, and the list of subpages for the current project.
While I could do something like hiding .pagelist ul ul ul in CSS, and then making .pagelist ul li.current_page_item visible, the nexted lists under .current_page_item always looked kind of stupid, since there's no way to style them individually. So I looked to squible. because I remembered karrde dealing with a submenu that showed other children of the current page's parent. so now my menu looks like this:
<div class="floatmenu">
<h2 id="page-title"">Mapping</h2>
<ul class="pagelist">
<?php wp_list_pages('exclude=164,202&sort_column=menu_order&depth=2&title_li='); ?>
</ul>
<h2 id="page-title"">Contents</h2>
<ul class="pagelist"><li><ul>
<?php /* karrde is a GOD. this comes from squible */
$kids = get_pages('child_of='. $post->ID);
if (count($kids) > 0) {
wp_list_pages('depth=1&sort_column=menu_order&title_li=&child_of='. $post->ID);
} else {
if ($post->post_parent != 0) {
wp_list_pages('depth=1&sort_column=menu_order&title_li=&child_of='. $post->post_parent);
}
}
?>
</ul></li></ul>
</div><!-- floatmenu -->
Now we get two menus, one of which shows projects and graphics, and their subpages (sortdepth=2 hides the subpages of the projects). The second menu shows only the children the current page, or the children of current page's parent. Works great for pages inside a project (example), or project pages (example). But when you're looking at Projects or Graphics, you get the same sub pages listed twice. Fixing that also fixed the styling issues with having a nested list in .current_page_item:
.pagelist .current_page_item li {
display: none;
}
HA! I love it. This won't work for every CMS use of wordpress. It works for me because i have relatively few 1st and 2nd level pages, and a whooooole lot of 3rd level pages.















4 Comments
Freak’n awesome post. This is exactly what I was looking for to take care of a two level sub nav problem. Cheers!
I want HTML (includes javascript) contents into post. But wordpress formats and changes few tags and strips the javascript tag(though i have disabled the option of using Rich Text Editor). I want to override wordpress formatting on per post basis.
With this scenario, bellow are my question:
1)Is this wpautop function is a global or specific that takes care of formatting ?
2)How can i avoid wordpress formatting only for blog post?
3)Is there any functions that takes care of blog post section only?
4)What does the function wptexturize does?
Thoughts are welcome
heh, i was just chatting about this last night with scott.
i have my own plugin that does a few simple things for me, one of which is
remove_filter ('the_content', 'wp_texturize');you could do the same for
wp_autopwp_texturize can be handily replaced by this plugin, which does a better job of not mucking up code/pre elements.
i’m not entirely clear on what wp_autop does, so i’m not sure what to recommend there.
I wish there is a plug in for this… is there? It would be great especially for those who do not know how to deal with coding.
One Trackback/Pingback
27 Sep 2006 at 2:42 pm
Converting a HTML Site To WordPress » The Affiliate Marketing Blog
[...] WP Sane Menu [...]
Post a Comment