Tagged: breadcrumbs, individual links, posts
-
AuthorPosts
-
August 5, 2024 at 5:29 pm #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
AnneAugust 6, 2024 at 5:14 am #1463901Hey 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,
IsmaelAugust 6, 2024 at 5:55 pm #1463967Hi 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ünchenI 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
AnneAugust 7, 2024 at 5:34 am #1463994Hi,
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,
IsmaelAugust 20, 2024 at 12:49 pm #1464966Hi 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
AnneAugust 21, 2024 at 6:04 am #1465033 -
AuthorPosts
- The topic ‘customize breadcrumb trail for posts oum-location’ is closed to new replies.