Question

I've tried both Yoast Breadcrumbs and Breadcrumbs NavXT and I can't seem to get either to work with custom post types. Anyone had any luck with this?

A single 'News' post on my site displays: Home -> Blog -> My News Post

Instead of correctly displaying: Home -> News -> My News Post

Was it helpful?

Solution

Breadcrumb NavXT has Custom Post Type support since 3.6.0. You might encounter some options problem. Please try to reset them or take a look on the development version. Backup your settings first with the export / import settings feature.

OTHER TIPS

As hakre said, Breadcrumb NavXT officially supports custom post types since version 3.6.0. I have tested it with both hierarchical and flat custom post types (and with custom taxonomies with flat custom post types).

There is a change in behavior for Breadcrumb NavXT in 3.7.0 (the next release) that allows you to set the root for custom post types. In version 3.6.0 it was assumed that all flat post types resided under the posts page (you see it as "blog" in the breadcrumb trail), and all hierarchical post types resided under the page on front (front page, or "Home" in your breadcrumb trail). This is already partially implemented in the SVN trunk (taxonomy based archives do not support this at the moment).

Unless "News" is a name of a term of some taxonomy of "My News Post", or the parent post to "My News Post" it will not show up at the moment. Per the above paragraph, with the development version you can have "News" be a page (built in WordPress "page" post type) and it will show up in the trail.

Currently, though, it seems that the use of custom post type in Breadcrumb NavXT requires one to create a dedicated page for the basis of the post type archive.

One other alternative is Breadcrumb Trail (http://wordpress.org/extend/plugins/breadcrumb-trail/). It seems to support custom post type... but for WP 3.1!! (That's what I assume from the codes, anyway, since it uses functions available only for WP 3.1+).

So I had modified the code a bit. But due to my needs at the time, I had integrated it with a couple of plug-ins... Meaning, it needs to have those plug-ins and with specific settings.

You can get the modified Breadcrumb Trail plugin from this link: http://www.zumodrive.com/share/8addOGQ3OW.

Then you will need to download and use the Custom Post Permalinks plugin as well (http://wordpress.org/extend/plugins/custom-post-permalinks/).

You can find explanation of the modifications and instructions in how to set it up in the modified plugin folder (called *modification_log.rtf*).

Basically, what you need to do after both plugins are activated is to first set up the 'Permalink Settings' as follows:

  • 'Common settings' to 'Month and name'
  • 'Extra Permalink Settings' to '/%post_type%/%your_custom_taxonomy%/%news_post%/'

This will setup the permalinks to something like:

www.yoursite.com/your_custom_post_type/your_custom_taxonomy_term/the_post

Then put the code below where you want your breadcrumbs to be:

<?php
// Plugin: Breadcrumb Trail (Modified) //
if(function_exists('breadcrumb_trail')) {
    $breadcrumb = array(
        'separator' => '>',
        'before' => 'You are here: ',
        'after' => false,
        'front_page' => true,
        'show_home' => __('Home'),
        'singular_{your_custom_post_type}_taxonomy' => 'your_custom_taxonomy',
        'echo' => true,
    );
    breadcrumb_trail($breadcrumb);
}
?>

This will allow breadcrumbs that look like this:

You are here: Home > Your Custom Post Type > Your Custom Taxonomy Term > The Post

Of course, you may be able to adjust it to your needs, but this is what I came up with for the project that I am doing.

I might have missed some necessary settings for the above to work, though... so just notify me if it didn't work.

Anyway, just wanted to share another solution... Hope this can come in handy for somebody.

By the way, the modified plugin also integrates with qTranslate plugin to allow multi-language...

Cheers!

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top