Community Forums › Forums › Archived Forums › General Discussion › Can't customize breadcrumbs separator
Tagged: breadcrumbs
- This topic has 5 replies, 2 voices, and was last updated 10 years ago by Zach Russell.
-
AuthorPosts
-
November 24, 2014 at 8:58 pm #132707Zach RussellMember
Hello,
I'm working on a custom child theme, and am trying to customize the breadcrumbs separator from
/
to>
(or maybe a Dashicon?) and I can't get it to work. Any idea what i'm doing wrong? Here is my code:add_filter( 'genesis_breadcrumbs_args', 'sbf_breadcrumbs_args' ); function sbf_breadcrumbs_args( $args ) { $args['home'] = 'Home'; $args['sep'] = ' > '; $args['list_sep'] = ', '; // Genesis 1.5 and later $args['prefix'] = '<div class="breadcrumb">'; $args['suffix'] = '</div>'; $args['heirarchial_attachments'] = true; // Genesis 1.5 and later $args['heirarchial_categories'] = true; // Genesis 1.5 and later $args['display'] = true; $args['labels']['prefix'] = 'You are here: '; $args['labels']['author'] = 'Archives for '; $args['labels']['category'] = 'Archives for '; // Genesis 1.6 and later $args['labels']['tag'] = 'Archives for '; $args['labels']['date'] = 'Archives for '; $args['labels']['search'] = 'Search for '; $args['labels']['tax'] = 'Archives for '; $args['labels']['post_type'] = 'Archives for '; $args['labels']['404'] = 'Not found: '; // Genesis 1.5 and later return $args; }
———-
Zach Russell
President, ProTech Internet GroupNovember 24, 2014 at 9:47 pm #132709coralseaitMemberHi,
I generally cheat and use Yoast SEO to customize the separator for a couple of reasons:
1) It is our standard for SEO optimization on sites
2) Yoast SEO / Genesis are aware of each other and typically don't conflict
3) Since it is usually installed per our standard stack, it is easy to use the Yoast interface to customize the separator
November 24, 2014 at 10:08 pm #132711Zach RussellMemberSo if I hook the yoast function into
genesis_before_entry
it works - except it shows on all posts and pages. I don't want that, If I try to wrap the hook into a!is_post()
oris_page()
it doesn't work. For example:<?php //* Add Yoast Breadcrumbs if( is_page() ) { add_action( 'genesis_before_entry', 'sbf_do_breadcrumbs' ); } function sbf_do_breadcrumbs() { if( function_exists( 'yoast_breadcrumb') ) { yoast_breadcrumb( '<p id="breadcrumbs">', '</p>'); } }
———-
Zach Russell
President, ProTech Internet GroupNovember 24, 2014 at 10:13 pm #132713Zach RussellMemberI was able to get it working, but it feels sloppy. Is this the best way to do it?
//* Add Yoast Breadcrumbs add_action( 'genesis_before_entry', 'sbf_do_breadcrumbs' ); function sbf_do_breadcrumbs() { if( ! is_front_page() and is_page() ) { if( function_exists( 'yoast_breadcrumb') ) { yoast_breadcrumb( '<p id="breadcrumbs">', '</p>'); } } }
———-
Zach Russell
President, ProTech Internet GroupNovember 24, 2014 at 10:30 pm #132714coralseaitMemberI wouldn't bother with a customized function, if you have Yoast SEO installed do:
1) Dashboard -> SEO -> Internal Links
Check Enable Breadcrumbs
Designate your Separator in the "Separator between breadcrumbs:" input2) Dashboard -> Genesis - Theme Settings
Breadcrumbs Section
Check which post / page / etc you wish bread crumbs to appear
November 25, 2014 at 2:37 pm #132796Zach RussellMemberOh wow, figures it was that easy - thanks for the tip!
———-
Zach Russell
President, ProTech Internet Group -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.