Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am implementing WP as a CMS for my church's website. This is the first WP install where I'm doing a lot of the custom coding myself instead of just finding plugins and a stock theme. As I am a bit unfamiliar with the new menu system, I have hit one snag that I cannot figure out. We have divided our site into "sections" via a customized top navigation (consisting of things like "About", "Religious Education", "Media", "Pastor's Blog", etc. We are creating custom menus in the admin for each of these sections. What I would like to is to have a left nav that "follows" the user through the sections.

Example Menu:

Section1 -> Page1-> Link to CategoryList1 -> Post23
Section2 -> Page4-> Link to CategoryList1 -> Post23

In both of these cases, I can get to CategoryList1 which would be the looper for all of the posts in a certain category. I could then get to Post23 from there. What I need, however, is for the left nav to still reflect what "section" (or top-level nav) I was in when I got to this list. I've thought of managing everything in pages and each page just containing shortcode to display what I want so that I could use custom page templates to always disply the proper menu, and that works fairly well (in my head) until I get to the actual post level. At some point, I always hit the "where did I come from?" wall at the category and post level. I know there are good plugins for breadcrumb management in this arena, but I've not found a plugin that allows me do this with menus. I know that WP does not natively support sessions, so I'm trying to figure out how this might be possible without enabling sessions, but that almost seems like the only option?

With sessions, I could just get my theme to read a session variable and grab the custom menu based off the session value. No session value means you're on the home page or came directly to a category, archive, or post from the home page, so no menu would be necessary. If you went to a section, you would hit a page template from somewhere, and that page template would be "section-aware" and write the session variable.

Are there any other ideas that anyone might have or any plugins I've missed that might cover this functionality?

Thanks so much!

share|improve this question

1 Answer 1

Even you wrote that you want to code everything yourself this time, you might want to consider to use a plugin for breadcrumbs, like (just to name one) Breadcrumb NavXT (Wordpress Plugin).

If it does not support what you need out of the box, you will find a least all the code how it has been originally done and probably it offers ways to customize the breadcrumb path for you. And if it's only to take a look how someone else is doing it.

As with your site, it looks to me that you're intermixing different stuff wordpress has to offer while aiming for one thing: site structure. IMHO this has the tendency to make things complicated.

The menu in wordpress is not designed to actually structure your content nor is there anything else that allows you to high-level structure content. The only thing I'm aware of to provide structured content in a hierarchy, is to use pages with childs and parents. Next to that you can provide a same named and structured tree of post categories which can help to streamline both the page structure with posts you could add for pages (or merely then sections of your site).

But even with such a simplified approach, most breadcrumb plugins won't work as they don't expect to have pages their own posts.

I'm pretty sure that there is a solution for what you want to do, and as an additional tip on how to integrate that easily is by either creating a template tag for you breadcrumb path and/or a shortcode or widget you can easily distribute it on your site even when you change the logic behind your site's structure.

And additionally, if you use the menu to structure your content, it should be possible to read that structure out and create a path out of it as it's normally a tree structure and the breadcrumb is displaying the path to the current item. In the end you only need to add the current post at the end of it (Post23 in your example) if you're on a single post page. That's probably the easiest approach if you define your site's structure within the menu.

Mtekk, the author of the breadcrumb plugin I named above is on this site as well, I bet he has some other valuable feedback for you.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.