Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1365750

    Hi
    i have
    …a CPT called “classes”.
    ….12 posts in this CPT.
    ….4 CPT-categories.
    ….a page with a masonry that calls all posts from all 4 CPT-categories.

    So far so good.

    The breadcrumb should of course help people to know where they are.
    Actually the breadcrumb is:
    Sie sind hier: Startseite/SinglePost
    But it should say at least:
    Sie sind hier: Startseite/PagewiththeMasonry/SinglePost
    (Startseite/Kurse/Geige-Anfänger/)

    How to fix that?

    regards
    Eva

    #1365828

    Hey evas49,

    Thank you for the inquiry.

    The parent page will only be included in the breadcrumb if it is set as the main blog page in the Enfold > Theme Options panel. Did you set the page containing the masonry element as the default blog page?

    You can also use the avia_breadcrumbs_trail filter to manually adjust the trail and include a specific page when a certain custom post type entry is in view. Usage example can be found in the following links.

    // https://kriesi.at/support/topic/events-events/#post-1354583
    // https://kriesi.at/support/topic/problem-with-breadcrumb/#post-1289346
    // https://kriesi.at/support/topic/breadcrumbs-when-a-parent-menu-item-is-a-custom-link/#post-1364287

    Best regards,
    Ismael

    #1366193

    Hi,
    1:Of course not, cause its a CPT.
    I wouldn`t use a CPT if i had blogposts still available.

    2:Whats the codesnippet i need to put in the functions.php to show the hierarchy in the breadcrumb?

    Eva

    #1366297

    Hi,

    Thank you for the inquiry.

    Try to use this filter in the functions.php file to append a custom trail to the breadcrumb.

    function avia_adjust_breadcrumb($trail) {
               if( is_singular( 'post_type' ) ) {
    	         $trail[1] = '<a href="https://site.com/pagewithmasonry" title="Page with Masonry" rel="pagewithmasonry"> PagewiththeMasonry </a>';
               }
    	   return $trail;
      }
      add_filter('avia_breadcrumbs_trail', 'avia_adjust_breadcrumb', 50, 1);
    

    Best regards,
    Ismael

    #1366360

    Almost, but:
    “Sie sind hier: Startseite / / PagewithMasonry TitleofClass”
    There are now:
    – 2 Slashes between “Startseite” and “PageWithMasonry”
    – No slash between “Page with Masonry” and “Title of Class”

    When i add a slash after the anchor ( PagewiththeMasonry /’;) i get a third slash after “Startseite”
    “Sie sind hier: Startseite / / / PagewithMasonry TitleofClass”

    This is strange cause when i use any other character (like X or – or anything else) than the character is behind “PageWithMasonry”
    Like “PageWithMasonry – ”
    But if i use a slash it gets strange

    #1366515

    Hi,

    Thank you for the update.

    Another user provided a custom code using the same filter, which might work in your case.

    // https://kriesi.at/support/topic/breadcrumbs-when-a-parent-menu-item-is-a-custom-link/#post-1366015

    Just replace this line with your own condition.

    if (is_page([36, 38, 40, 42, 44])) {
            $parentIsCustomLink = true;
            $parentBreadcrumb = '<a href="https://www.mydomain.com/our-office-highlights/" title="About" rel="home" class="trail-begin">About</a>';
        }
    

    Or post the login details in the private field so that we can test it in your installation directly.

    Best regards,
    Ismael

    #1366744

    “Just replace this line with your own condition.”
    This is unprecise.
    1: instead of the code you gave me yesterday or additional? If additional- how?
    2: What conditions are we talking about?

    kind regards
    eva

    #1367410

    Hi Eva,

    1- Instead of the code Ismael gave you earlier.

    2- In your case, you can use post ID to apply it on selected posts. It should look as following

    
    if (is_single([36, 38, 40, 42, 44])) {
            $parentIsCustomLink = true;
            $parentBreadcrumb = '<a href="https://www.mydomain.com/our-office-highlights/" title="About" rel="home" class="trail-begin">About</a>';
        }
    
    

    You can edit your posts to find their ID’s in your browsers navigation bar – https://imgur.com/a/WtzMFZ5 and replace the IDs (36, 38, 40, 42, 44) in the example

    Best regards,
    Yigit

    #1367463

    Hi Yigit

    1: Your code does not work at all. Its still “Startseite / Name of the Post”
    2: The code Ismael gave has more issues than just the 2 “/ /”.
    On mobile the breadcrumb shows the wrong order..
    It says “Startseite / Name of the post / Home of masonry”
    3: “if is single” means a condition for every single page which makes a lot of work.
    There must be a better way.
    Something like “if is CPT courses” or so

    eva

    PS: The rel attribute you added seems wrong to me cause its not any kind of relation

    • This reply was modified 2 years, 1 month ago by evas49.
    #1367525

    Hey!

    Using the first filter works fine on our end. The second one might need a bit of adjustment. Have you tried to replace the condtion with the is_singular function?

    if (is_page([36, 38, 40, 42, 44])) {
            $parentIsCustomLink = true;
            $parentBreadcrumb = '<a href="https://www.mydomain.com/our-office-highlights/" title="About" rel="home" class="trail-begin">About</a>';
        }
    

    to..

     if( is_singular( 'post_type' ) ) {
    	           $parentIsCustomLink = true;
            $parentBreadcrumb = '<a href="https://www.mydomain.com/our-office-highlights/" title="About" rel="home" class="trail-begin">About</a>';
     }
    

    Make sure to replace post_type with the actual name of your own custom pos type. Please provide access to the site so that we can test the modifications.

    Best regards,
    Ismael

    #1367534

    “Have you tried to replace the condtion with the is_singular function?”
    Did i say anything that makes you think that i understand PHP?
    So why dont you simply paste a complete code instead of let me spend my time with trying to understad semi cryptical “advises” and timewasting trial & errors?

    Yes, i replaced post_type with the actual name of my own custom post type.
    But even your new code does not work.
    It is still: “Startseite / Name of the Post
    Are you sure that the codes you gave are complete?

    The first code you gave worked – except the fact that that were 2 slashes.
    Why dont you just try to follow this idea?

    eva

    #1367564

    Hi,

    Our support does not include customization however we try to be as helpful as possible. You do not give us enough information, not even a link of your website and expect us to give you a fully customized code depending on your answers.

    Let us not waste any more time. If this is something you really need, hire a freelance developer.

    Best regards,
    Yigit

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Breadcrumb does not show hierarchy’ is closed to new replies.