Viewing 22 posts - 1 through 22 (of 22 total)
  • Author
    Posts
  • #242117

    I saw a few other topics discussing a similar problem, but my problem is a bit different.

    I have customized our portfolio permalinks to “work” and “work-category” in order to coordinate with our portfolio landing page entitled “Work.” When approaching any portfolio entry from the “Work” page, the breadcrumb appears correctly, like this:

    good breadcrumb

    However, if you approach any portfolio entry from any other page via a post slider or a portfolio grid, it displays the following incorrect breadcrumb every time:

    bad breadcrumb

    When hovering over any link to any portfolio entry, regardless of where it is, the correct URL appears. I could use some help with this one….

    Thanks,
    DC

    #242280
    This reply has been marked as private.
    #242485

    Hey!

    Please try to add this on functions.php to fix the portfolio breadcrumbs:

    add_action('after_setup_theme','avia_remove_portfolio_breadcrumb');
    
    function avia_remove_portfolio_breadcrumb(){
    remove_filter('avia_breadcrumbs_trail','avia_modify_breadcrumb');
    }

    Best regards,
    Ismael

    #242764

    This is kind of working, but it needs a tweak – it is now adding every selected work category into the breadcrumb sequence:

    almost good breadcrumb

    How can we get it to just be “Home / Work / Portfolio Entry”?

    Thanks for your help!
    dc

    #243178

    Hi!

    Please try following code:

    
    if(!function_exists('avia_modify_single_portfolio_breadcrumb'))
    {
        function avia_modify_single_portfolio_breadcrumb($trail)
        {
    		if(!is_single() || get_post_type() != 'portfolio') return $trail;
    		$category = get_the_category(get_the_ID());
    		$newtrail = array();
    
    		$parents = get_the_term_list(get_the_ID(), 'portfolio_entries', '', '$$$', '' );
    		$parents = explode('$$$',$parents);
    		if(!empty($parents[0])) $newtrail[] = $parents[0];
    
            return $newtrail;
        }
    
        add_filter('avia_breadcrumbs_trail','avia_modify_single_portfolio_breadcrumb');
    }
    

    - it will just display the first category in the term array. Insert it into your child theme functions.php file.

    Cheers!
    Peter

    #243372

    Adding that code as well removes the entire breadcrumb, leaving only “You are here:” –

    Just to confirm, I’ve added both of these suggestions to the end of the functions.php file.

    require_once( ‘functions-enfold.php’);

    add_action(‘after_setup_theme’,’avia_remove_portfolio_breadcrumb’);

    function avia_remove_portfolio_breadcrumb(){
    remove_filter(‘avia_breadcrumbs_trail’,’avia_modify_breadcrumb’);
    }

    if(!function_exists(‘avia_modify_single_portfolio_breadcrumb’))
    {
    function avia_modify_single_portfolio_breadcrumb($trail)
    {
    if(!is_single() || get_post_type() != ‘portfolio’) return $trail;
    $category = get_the_category(get_the_ID());
    $newtrail = array();

    $parents = get_the_term_list(get_the_ID(), ‘portfolio_entries’, ”, ‘$$$’, ” );
    $parents = explode(‘$$$’,$parents);
    if(!empty($parent_item[0])) $newtrail[] = $parent_item[0];

    return $newtrail;
    }

    add_filter(‘avia_breadcrumbs_trail’,’avia_modify_single_portfolio_breadcrumb’);
    }

    Try again? Thanks…

    #243676

    Hi!

    Please create me an admin account and post the login credentials as private reply – I’ll check why it’s not working for you.

    Cheers!
    Peter

    #243847
    This reply has been marked as private.
    #244104

    Hey tcctemp and Peter I have been searching for this same thing:

    Home / Portfolio page / Portfolio Entry

    FYI I tried the above code and it resulted in removing Home and Portfolio entry from breadcrumb:

    / Portfolio Page /

    I’ve read countless threads regarding portfolio breadcrumb including the one with the code below from Peter.
    This achieves setting the ‘parent’ but also includes all the other portfolio categories which in many cases can be 10 or more.
    Possibly this could be modified to only include ‘parent’ / portfolio item and not the categories

    note: replace 20 with the desired parent page id

    function avia_modify_breadcrumb($trail)
    	{
    		if(get_post_type() === "portfolio")
    		{
    			$page = 20;
    			if($page)
    			{
    				if($page == $front)
    				{
    					$newtrail[0] = $trail[0];
    					$newtrail['trail_end'] = $trail['trail_end'];
    					$trail = $newtrail;
    				}
    				else
    				{
    					$newtrail = avia_breadcrumbs_get_parents( $page, '' );
    					array_unshift($newtrail, $trail[0]);
    					$newtrail['trail_end'] = $trail['trail_end'];
    					$trail = $newtrail;
    				}
    
    			}
    		}
    		else if(get_post_type() === "post" && (is_category() || is_archive() || is_tag()))
    		{
    
    			$front = avia_get_option('frontpage');
    			$blog = avia_get_option('blogpage');
    
    			if($front && $blog)
    			{
    				$blog = '<a href="' . get_permalink( $blog ) . '" title="' . esc_attr( get_the_title( $blog ) ) . '">' . get_the_title( $blog ) . '</a>';
    				array_splice($trail, 1, 0, array($blog));
    			}
    
    		}
    
    		return $trail;
    	}
    	
    }
    

    I also discovered google must have first crawled another portfolio masonary page and as a result it was stored as the session id “breadcrumb’ for all subsequent portfolio entries even if they weren’t included on that particular masonary portfolio page.

    • This reply was modified 8 months ago by  ttem.
    • This reply was modified 8 months ago by  ttem.
    • This reply was modified 8 months ago by  ttem. Reason: add more info
    #244242

    Hey!

    @tcctemp please send me the login credentials to (Email address hidden if logged out)

    Best regards,
    Peter

    #244376
    This reply has been marked as private.
    #244378
    This reply has been marked as private.
    #244749

    Hey!

    I checked the code and I found the issue but I eventually removed it because I think you don’t need to modify the breadcrumb. Try to clear the browser cache, then go to http://2013.traverscollins.com/work/ and open “SOUTHTOWNS RADIOLOGY”. The breadcrumb structure should be “You are here:Home / Work / Southtowns Radiology”. I tested it on my PC and the breadcrumb seems to work just fine: http://www.clipular.com/c/6148634554925056.png?k=sqVTvEyjn0I3oPB-VoJbkvmEJZI and uses the structure you requested here: http://www.kriesi.at/support/topic/portfolio-breadcrumbs-are-displaying-incorrectly/#post-242764

    Cheers!
    Peter

    #244899

    Having the same issue was this ever solved?

    #244989

    Hey!

    If you need help please create a new thread and post more details. If you want to show the first category instead of the portfolio/masonry grid page in the breadcrumb use the code I posted here: http://www.kriesi.at/support/topic/portfolio-breadcrumbs-are-displaying-incorrectly/#post-243178

    Cheers!
    Peter

    #246130

    Hi Peter:

    It’s still not working. The problem isn’t necessarily from the “Work” page, but when you enter any portfolio entry through a post slider or a portfolio grid added to other pages. It’s modifying the breadcrumb in a way that sometimes seems tied to the page that I just navigated from, and other times it is seemingly random and not at all related.

    Try navigating from the home page, or any of the subpages of “Marketing Capabilities,” and you’ll see what I’m talking about.

    #246385

    Hi!

    Ok, in this case Ismael was right and you must overwrite the default breadcrumb. I added this code to the functions.php file:

    
    if(!function_exists('avia_modify_breadcrumb'))
    {
        function avia_modify_breadcrumb($trail)
        {
            if(get_post_type() === "portfolio")
            {
                $page = 9;
    
                if($page)
                {
                    if($page == $front)
                    {
                        $newtrail[0] = $trail[0];
                        $newtrail['trail_end'] = $trail['trail_end'];
                        $trail = $newtrail;
                    }
                    else
                    {
                        $newtrail = avia_breadcrumbs_get_parents( $page, '' );
                        array_unshift($newtrail, $trail[0]);
                        $newtrail['trail_end'] = $trail['trail_end'];
                        $trail = $newtrail;
                    }
                }
            }
            else if(get_post_type() === "post" && (is_category() || is_archive() || is_tag()))
            {
    
                $front = avia_get_option('frontpage');
                $blog = avia_get_option('blogpage');
    
                if($front && $blog && $front != $blog)
                {
                    $blog = '<a href="' . get_permalink( $blog ) . '" title="' . esc_attr( get_the_title( $blog ) ) . '">' . get_the_title( $blog ) . '</a>';
                    array_splice($trail, 1, 0, array($blog));
                }
            }
            else if(get_post_type() === "post")
            {
                $front = avia_get_option('frontpage');
                $blog = avia_get_option('blogpage');
    
                if($blog == $front)
                {
                    unset($trail[1]);
                }
            }
    
            return $trail;
        }
    
        add_filter('avia_breadcrumbs_trail','avia_modify_breadcrumb');
    }
    
    

    9 is the id of your “work”/portfolio page.

    Cheers!
    Peter

    #246554

    Peter:

    It still doesn’t appear to be working.

    Please try to access individual portfolio items from the following pages and check the breadcrumbs:

    (From the post slider or the portfolio grid under “Nice Work (If You Can Get It”)

    http://2013.traverscollins.com/us/people/bill-collins/

    (From the portfolio grid under “WORK: Our Latest & Greatest”)

    http://2013.traverscollins.com/

    (From the portfolio grid under “Advertising & Media Work” and from the sidebar widget “OUR LATEST WORK”)

    http://2013.traverscollins.com/us/marketing-capabilities/advertising-media/

    Most of the time, it seems to be creating the breadcrumb from whatever page the post had loaded into, rather than its actual breadcrumb. But occasionally, especially from the home page, it’s still just strangely defaulting to “Home / Us / People / Sarah DiPofi”….

    I’m not sure what else to say, but I’ve tested this in multiple browsers, logged in and logged out, and it hasn’t gone away at all. I’m pretty close to just turning the headers off for portfolio entries. Do you want to give it another try?

    #246881

    Hey!

    Ah, ok. If you link to the same portfolio entry from different pages the breadcrumb can’t be consistent. WordPress doesn’t know which “masonry page” is the parent page of a “single portfolio entry” because the masonry grid is actually just a shortcode which is embedded into the content of a page. Kriesi found a workaround and Enfold stores the id of the parent portfolio/grid page into a session.

    I.e. if the user first views this portfolio grid page (http://2013.traverscollins.com/us/marketing-capabilities/advertising-media/ ) the server will save the page id into the session and as soon as the user views the single portfolio entry (i.e. http://2013.traverscollins.com/work/harper-international/ ) Enfold uses the session data and the saved page id to build the breadcrumb (You are here:Home / Us / Marketing Capabilities / Advertising & Media / Harper International). If the user accesses the portfolio entry from another portfolio page: i.e. from http://2013.traverscollins.com/work/ the breadcrumb structure might be different. Note that you need to clear the browser cache to remove the session data if you want to test this.

    You’ve three options:

    1) Make sure that the same portfolio items are not part of several masonry or portfolio grids and remove the masonry/portfolio grid from the other pages.

    2) Remove the breadcrumb

    3) Try another breadcrumb like Yoast SEO – maybe it gives you better results for your project.

    Regards,
    Peter

    #246947

    Thank you Peter I am following this thread as I have the same problem.

    Is there a way to hard code the breadcrumb for all portfolio entries to Home / Portfolio (specified id of the main parent portfolio/grid) / Portfolio Item
    without any of the portfolio categories in the breadcrumb

    So regardless of whether there may be many portfolio masonry grid pages just assign the main one’s page-id as the the parent breadcrumb to all portfolio items

    can this be achieved with avia modify breadcrumb function?

    #247080

    Theoretically, I understand what you are saying, but I don’t understand why you would go out of your way to treat portfolio content any differently. And why can’t it just access the permalink for the entry to create the breadcrumb? That never changes.

    Actually, as I look now, perhaps this is why the header and breadcrumb are removed from the blog and posts. If that’s so, then I really don’t have much of an option but to do the same thing on the portfolio. It’s too confusing to display different breadcrumbs, especially in the instances when I can’t control it, like on the home page where it’s pulling in a random sub-page as the lead-in.

    Personally, I also think it’s way too much to expect that each portfolio entry (or any other rich content) would only display on one single page, especially when it comes to the existence of sidebar widgets and the avia sliders.

    #247399

    Hey!

    I tagged the thread for Kriesi. I’m pretty sure he can work something out for the next update. Maybe he can include a new option to set the “parent” page of a portfolio/post entry with a post meta field, etc.

    Best regards,
    Peter

Viewing 22 posts - 1 through 22 (of 22 total)

You must be logged in to reply to this topic.