I have the same problem. I would only like breadcrumbs for pages, not categories. Is there any way to accomplish this?
You should not be using pages to replace taxonomy (in this case category) term archives. That said, this is possible to do. The easiest way is to have get_term_link() to return the URL you want (without the ‘category/’). You’ll have to dig around to find the filter you’ll need but that’s where you should start hunting. BTW, this has been asked before, and in a previous response I believe I dove a little deeper in my outline of how to do this.
Thanks for the quick response. I’ll see if I can find that older post were you explain it.
I’ve setup an instance of wordpress that is functioning as a guitar photo gallery. So it’s not a conventional use of wordpress so I’m not sure adhering to the taxonomy is that critical.
thanks for your help…
Thread Starter
Kamlesh
(@kamleshpawar2006)
mtekk,can you provide me the link of post where you discussed it.
Found it (or at least another answer I gave before):
If you are going to use pages in place of category archives, you need to know that you need to hook into the term_link filter so that get_term_link() returns the URL to the Page (the post type) corresponding to the category. Without doing this, there is no way for 3rd party plugins to know where to link to.
So term_link
is the filter you want to use.
I have the same problem but still can’t see how to solve it!
I’ve found the following bit of code which I think is what you mention above:
//Figure out the anchor for current category
$breadcrumb->set_url(get_term_link($term, $term->taxonomy));
}
//Get parents of current category
if($term->parent)
{
$this->term_parents($term->parent, $term->taxonomy);
}
How should this be changed so that a particular page is put into the breadcrumbs instead of the taxonomy?
Thread Starter
Kamlesh
(@kamleshpawar2006)
@pictori:we need to link it to page url of that page which contains the post.But how to do that.
Thread Starter
Kamlesh
(@kamleshpawar2006)
i am new to wordpress, and don’t know how to hook so that get_term_link() return page URL.please help mtekk.
Hi guyz,
Same issue here. Is there anyone who could support us on this issue. Please guide us on how to change this code:
the anchor for current category
$breadcrumb->set_url(get_term_link($term, $term->taxonomy));
}
//Get parents of current category
if($term->parent)
{
$this->term_parents($term->parent, $term->taxonomy);
}
Appreciate it a lot!
You should not be modifying the plugin at all to do this. You need to hook into the term_link
filter to properly update the URL set by get_term_link()
. How you actually grab the page link for the category depends on how you are doing the mapping of categories to pages. Assuming you are using the WordPress menu system, you should just wait for Breadcrumb NavXT Menu Magic to be released. I want to say it will be available by Monday, but realistically, it will be available by the end of March.