Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1463856

    Dear Kriesis,
    I’m using the OUM-Plugin and want to display a custom breadcrumb trail. I disabled categories in the breadcrumb trail and want to insert page links.
    e.g.:

    Now the trail is:
    Home > Münzen-Modes
    This is what I want:
    Home > Länder > Deutschland (page) > München (page) > Münzen-Modes (oum-location=post)

    A usefull script would be great!
    Best regards
    Anne

    #1463901

    Hey annevoelkel,

    Thank you for the inquiry.

    How do these pages relate to each other? If you just need to add custom links to the breadcrumb trail, please try adding this filter to the functions.php file.

    function avia_breadcrumbs_trail_mod($trail) {
        global $post;
    
        if ( is_singular( 'post' ) ) {
            $end = $trail['trail_end'];
            unset($trail['trail_end']);
            unset($trail[2]);
    
            $trail[] = '<a href="' . home_url('/lander/') . '" title="Länder" rel="">Länder</a>';
            $trail[] = '<a href="' . home_url('/lander/deutschland/') . '" title="Deutschland" rel="">Deutschland</a>';
            $trail[] = '<a href="' . home_url('/lander/deutschland/munchen/') . '" title="München" rel="">München</a>';
            $trail[] = $end;
        }
    
        return $trail;
    }
    add_filter('avia_breadcrumbs_trail', 'avia_breadcrumbs_trail_mod', 50, 1);
    
    

    Best regards,
    Ismael

    #1463967

    Hi Ismael,
    thanks for the code but unfortunately it doesn’t work. The posts don’t have any relation to pages but I want to add links to overview pages to the breadcrumbs.
    E.g. OUM-post “Münzen-Modes”
    home URL is https://numismatic-directory.com/oum-location/muenzen-modes/
    or OUM-post “Münzgalerie München”

    This is what the breadcrumbs should look like:
    Home > Länder > Deutschland > München > Münzen-Modes
    Home > Länder > Deutschland > München > Münzgalerie München

    I added this this code into my functions.php but nothing changed.

    /* individuelle Breadcrumbs in OUM-Beiträgen > Code von Kriesi August 6, 2024 at 5:14 am */
    function avia_breadcrumbs_trail_mod($trail) {
    global $post;

    if ( is_singular( ‘post’ ) ) {
    $end = $trail[‘trail_end’];
    unset($trail[‘trail_end’]);
    unset($trail[2]);

    /* $trail[] = ‘Länder‘;
    $trail[] = ‘Deutschland‘;
    $trail[] = ‘München‘;*/
    $trail[] = ‘München‘;
    $trail[] = ‘Münzgalerie München” rel=””>München‘;
    $trail[] = $end;
    }

    return $trail;
    }
    add_filter(‘avia_breadcrumbs_trail’, ‘avia_breadcrumbs_trail_mod’, 50, 1);

    Best regards
    Anne

    #1463994

    Hi,

    Thank you for the update.

    You may need to remove this conditional function:

    if ( is_singular( ‘post’ ) ) {
    

    or replace it with:

    if ( is_page() ) {
    

    Best regards,
    Ismael

    #1464966

    Hi Ismael,
    sorry for the late reply. It doesn’t work and I can’t edit every single post individually either (there are to many). So Ieave like it is.
    Best regards
    Anne

    #1465033

    Hi,

    The filter works fine on our end, and replacing the condition with is_page should apply it to every page. Please feel free to open another thread if you have more questions about the theme.

    Have a nice day.

    Best regards,
    Ismael

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘customize breadcrumb trail for posts oum-location’ is closed to new replies.