Working on breadcrumbs for a WordPress theme. Attachments may belong to either a post or a page, and I would like them to appear accordingly in my breadcrumbs.
This is the function for my breadcrumbs:
function breadcrumbs() {
$delimiter = ''; $home = 'Home'; // text for the 'Home' link $before = '<li class="current">'; // tag before the current crumb $after = '</li>'; // tag after the current crumb
if ( !is_home() && !is_front_page() || is_paged() ) {
Wow there is a lot going on there for breadcrumbs! Have you considered simply using a plugin and modifying it? I've had a lot of success with modifying this one: http://wordpress.org/extend/plugins/breadcrumb-navxt/
This is the function for my breadcrumbs:
The portion of that function now being called into question is this:
If the attachment belongs to a page, the breadcrumbs display perfectly.
However, if the attachment belongs to a post, the breadcrumbs omit the Category of that post, and only show as:
Home > Post Title > Attachment
What I want is:
Home > Category > Post Title > Attachment
... for attachments belonging to posts, and ...
Home > Parent Page > Child Page > Attachment
... for attachments belonging to pages.
Does anyone have a clue how I might accomplish this?