Breadcrumb and formatting issues
-
I have a website that is being organized using posts and pages, the pages are used for product pages and categories and sub categories and the posts are used for the individual products.
You can take a look at the structure below using the links. The problem I am having is using the breadcrumbs code, since it uses $post->parent. So the code works great for the hierarchy until you click on the individual products, which takes you to the “posts” section of the website. I hope I’ve explained myself correctly and really appreciate the help.
http://dwmultimediadesign.com/hosting/wordpress2/ingredients/av/av-pw/av-pw-par/
<?php $parent_id = $post->post_parent; $breadcrumbs = array(); while ($parent_id) { $page = get_page($parent_id); $breadcrumbs[] = '<a href="'.get_permalink($page->ID).'" title="">'.get_the_title($page->ID).'</a>'; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse($breadcrumbs); foreach ($breadcrumbs as $crumb) echo "$crumb"; ?>
The topic ‘Breadcrumb and formatting issues’ is closed to new replies.