Breadcrumbs..Change the shop link to a different URL

Modern e-commerce WordPress theme to build successful online store with WooCommerce support.
GK User
Thu Nov 07, 2013 6:50 am
Hi,

I am trying to customise my breadcrumb for "artists" so that the url points to a wordpress page.

Home / Artists / Emily Nampijinpa Hudson (see attachment)

breadcrumbs-url.jpg


I am able to change the "home" link url but not the "artist" url (shop)

Code: Select all
    
add_filter( 'woocommerce_breadcrumb_home_url', 'woo_custom_breadrumb_home_url' );
function woo_custom_breadrumb_home_url() {
return 'http://woothemes.com';
}


Any assistance would be great,Thanks

Regards Michael
User avatar
Junior Boarder

GK User
Thu Nov 07, 2013 10:16 pm
Hi,

Emily Nampijinpa Hudson is a page inside artists category, so this link opens artists category. You could edit gavern/helpers.layout.php file and gk_breadcrumbs_output function, but it's not a good solution.
User avatar
Moderator

GK User
Thu Nov 07, 2013 11:50 pm
Hi Piotr,

That's so much for you reply. I have tried to edit gavern/helpers.layout.php file and gk_breadcrumbs_output function, but I am struggling to change the Artist breadcrumb url link when viewing woocommerce category and single product page?

I would really appreciate your help on what i need to edit to get this to work? thanks for your time:)

regards
Michael

Code: Select all
function gk_breadcrumbs_output() {
   // open the breadcrumbs tag
   $output = '<nav class="gk-breadcrumbs">';
   // check if we are on the post or normal page
   if (!is_home()) {
      // return the Home link
      $output .= '<a href="' . home_url() . '" class="gk-home">' . apply_filters('gavern_breadcrumb_home', get_bloginfo('name')) . "</a>";
      // if page is category or post
      if (is_category() || is_singular()) {
         // return the category link
         $output .= get_the_category_list(' ');
         // if it is a post page
         if (is_singular()) {
            // return link the name of current post
            $output .= '<span class="gk-current">' . get_the_title() . '</span>';
         }         
      // if it is a normal page
      } elseif (is_page()) {
         // output the page name
         $output .= get_the_title('<span class="gk-current">', '</span>');
      } elseif (is_tag() && isset($_GET['tag'])) {
         // output the tag name
         $output .= '<span class="gk-current">' . __('Tag: ', GKTPLNAME) . strip_tags($_GET['tag']) . '</span>';
      } elseif (is_author() && isset($_GET['author'])) {
         // get the author name
         $id = strip_tags($_GET['author']);
         if(is_numeric($id)) {
            // output the author name
            $output .= '<span class="gk-current">' . __('Published by: ', GKTPLNAME) . get_the_author_meta('display_name', $id) . '</span>';
         }
      } elseif(is_404()) {
         $output .= '<span class="gk-current">' . __('Page not found', GKTPLNAME) . '</span>';
      } elseif(is_archive()) {
         $output .= '<span class="gk-current">' . __('Archives', GKTPLNAME) . '</span>';
      } elseif(is_search() && isset($_GET['s'])) {
         // output the author name
         $output .= '<span class="gk-current">' . __('Searching for: ', GKTPLNAME) . strip_tags($_GET['s']) . '</span>';
      }
   // if the page is a home
   } else {
      // output the home link only
      $output .= '<a href="' . home_url() . '" class="gk-home">' . get_bloginfo('name') . "</a>";
   }
   // close the breadcrumbs container
   $output .= '</nav>';
   
   echo apply_filters('gavern_breadcrumb', $output);
}
User avatar
Junior Boarder

GK User
Fri Nov 08, 2013 8:24 am
Hi,

Unfortunately I'm not sure what do you want to achieve, this function returns category and product/post/page (last item). You want to show on every page instead of category - link to a static page? So you should completely rebuild gk_breadcrumbs_output function and it's decisively beyond our technical support.
User avatar
Moderator


cron