-
AuthorPosts
-
May 21, 2014 at 1:11 am #267726
How do you get the portfolio category to display in the URL and Breadcrumbs?
Right now I have items that are broken into categories and sub categories.. however, the breadcrumbs and urls do not reflect this .
CATEGORY: Craftsman SUB-CATEGORY: Long plate
When I’m on the “Craftsman” page… I would expect the url and breadcrumbs to display the following:
URL portfolio-item/Craftsman/ Breadcrumbs to be: HOME / COLLECTION / CRAFTSMAN
This works fine…
Here’s where the trouble is:
When I’m on the Long Plate page… I would expect this:
URL …portfolio-item/Craftsman/Long-Plate/ Breadcrumbs to be: HOME / COLLECTION / CRAFTSMAN / LONG PLATE
But I’m getting this ….. portfolio-item/Long-Plate Breadcrumbs: HOME/COLLECTION/LONG-PLATE
EXAMPLE 2
(it’s completely leaving out the CRAFTSMAN category)I can send you a link privately to better explain.
- This topic was modified 10 years, 6 months ago by sfierst.
May 22, 2014 at 9:20 am #268499Hi sfierst!
1) The portfolio urls/permalinks do not support categories or other dynamic elements – I’m sorry. You would need to hire a developer who can help you to customize the permalinks code.
2) If you want to show the categories in the breadcrumb insert this code into the child theme functions.php file (or insert it at the bottom of enfold/functions.php) if you’re not using a child theme:
if(!function_exists('avia_modify_portfolio_breadcrumb')) { function avia_modify_portfolio_breadcrumb($trail) { $parent = get_post_meta(avia_get_the_ID(), 'breadcrumb_parent', true); if(get_post_type() === "portfolio") { $page = ""; $front = avia_get_option('frontpage'); if(empty($parent) && !current_theme_supports('avia_no_session_support') && session_id() && !empty($_SESSION['avia_portfolio'])) { $page = $_SESSION['avia_portfolio']; } else { $page = $parent; } if(!$page || $page == $front) { $args = array( 'post_type' => 'page', 'meta_query' => array( array( 'key' => '_avia_builder_shortcode_tree', 'value' => 'av_portfolio', 'compare' => 'LIKE' ) ) ); $query = new WP_Query( $args ); if($query->post_count == 1) { $page = $query->posts[0]->ID; } else if($query->post_count > 1) { foreach($query->posts as $entry) { if ($front != $entry->ID) { $page = $entry->ID; break; } } } } $parents = get_the_term_list( $post_id, 'portfolio_entries', '', '$$$', '' ); $parents = explode('$$$',$parents); if($page) { if($page == $front) { $newtrail[0] = $trail[0]; foreach ($parents as $parent_item) { if($parent_item) $newtrail[] = $parent_item; } $newtrail['trail_end'] = $trail['trail_end']; $trail = $newtrail; } else { $newtrail = avia_breadcrumbs_get_parents( $page, '' ); array_unshift($newtrail, $trail[0]); foreach ($parents as $parent_item) { if($parent_item) $newtrail[] = $parent_item; } $newtrail['trail_end'] = $trail['trail_end']; $trail = $newtrail; } } } return $trail; } add_filter('avia_breadcrumbs_trail','avia_modify_portfolio_breadcrumb', 15, 1); }
Cheers!
PeterOctober 20, 2016 at 1:07 pm #701836While adding the above code, the portfolio category breadcrumbs displaying twice in the portfolio category page.
Home » Careers » Life @ ISYX » Sales and Competencies Meet #2016 in #Dubai #UAE » Sales and Competencies Meet #2016 in #Dubai #UAEOctober 21, 2016 at 6:48 am #702177Hi,
Could you post a link to the site in question so that we can take a closer look please?
Thanks,
RikardOctober 21, 2016 at 9:07 am #702225October 22, 2016 at 7:51 am #702731 -
AuthorPosts
- You must be logged in to reply to this topic.