Tagged: x
-
AuthorPosts
-
December 2, 2016 at 6:58 pm #1279428
khomikoParticipantI would like to add a [x_icon type=”gamepad”] which links to a different page before the home button. I posted a lazy image of the idea lol. Is there a code I can use to add to my functions.php file which would put that icon before the house icon and let me link it to a different page?
December 2, 2016 at 11:16 pm #1279553
Rue NelModeratorHello There,
Thanks for writing in! To resolve your issue, since you already have your child theme active and ready, please insert this following code in your child theme’s functions.php file.
// Breadcrumb Home Text // ============================================================================= function x_get_breadcrumb_home_text() { return do_shortcode('[x_icon type="gamepad"]') . '<span class="home"><i class="x-icon-home" data-x-icon=""></i></span>'; } // =============================================================================Please get the raw code here (http://pastebin.com/ndVhyLqe) to preserved the Unicode Html Entity or the data-x-icon value.
Hope this helps. Please let us know how it goes.
December 3, 2016 at 2:03 am #1279649
khomikoParticipantHow do I link it to a page?
December 3, 2016 at 2:05 am #1279656
khomikoParticipantI want the [x_icon type=”gamepad”] Icon to link to a different page and I want the House icon to link to the homepage.
December 3, 2016 at 2:09 am #1279659
Rue NelModeratorHello There,
Thanks for the updates! If you want to add a link and the icon, please insert this following code in your child theme’s functions.php file
// Breadcrumb Home Text // ============================================================================= function x_get_breadcrumb_home_text() { return '<a href="#your-link-her">' . do_shortcode('[x_icon type="gamepad"]') . '</a> <span class="home"><i class="x-icon-home" data-x-icon=""></i></span>'; } // =============================================================================Please get the raw code here (http://pastebin.com/Aa7z2nHP) to preserved the Unicode Html Entity or the data-x-icon value.
Hope this helps. Please let us know how it goes.
December 3, 2016 at 2:12 am #1279661
khomikoParticipantFor example: Go to ix3gaming.com and check out how the breadcrumbs are set up. That’s good. I just want the gamepad to link to ix3gaming.com/groups.
December 3, 2016 at 2:14 am #1279662
khomikoParticipantSorry, your post beat mine :P. Almost there. I want the house to still link to the home page.
December 3, 2016 at 2:17 am #1279664
ChristopherModeratorHi there,
Currently the icon is linking to
ix3gaming.com/groups, please see the attachment.Hope it helps.
December 3, 2016 at 2:19 am #1279668
khomikoParticipantI want [x_icon type=”home”] to link to http://ix3gaming.com and [x_icon type=”gamepad”] to link to http://ix3gaming.com/groups/
December 3, 2016 at 2:38 am #1279672
Rue NelModeratorHello There,
Please try using this code instead:
// Breadcrumb Home Text // ============================================================================= function x_get_breadcrumb_home_text() { $gamepad = '<a href="http://ix3gaming.com/groups/">' . do_shortcode('[x_icon type="gamepad"]') . '</a>' . x_get_breadcrumb_delimiter(); return $gamepad . '<span class="home"><i class="x-icon-home" data-x-icon=""></i></span>'; } // =============================================================================Please get the raw code here (http://pastebin.com/pZ4NAqQM) to preserved the Unicode Html Entity or the data-x-icon value.
Hope this helps. Please let us know how it goes.
December 3, 2016 at 2:44 am #1279675
Rue NelModeratorHello Again,
And if still doesn’t work out, please totally remove the code and place it with this code:
// Custom Breadcrumb // ============================================================================= function x_breadcrumbs() { if ( x_get_option( 'x_breadcrumb_display' ) ) { GLOBAL $post; $is_ltr = ! is_rtl(); $stack = x_get_stack(); $delimiter = x_get_breadcrumb_delimiter(); $home_text = x_get_breadcrumb_home_text(); $gamepad = '<a href="http://ix3gaming.com/groups/">' . do_shortcode('[x_icon type="gamepad"]') . '</a>' . x_get_breadcrumb_delimiter(); $home_link = home_url(); $current_before = x_get_breadcrumb_current_before(); $current_after = x_get_breadcrumb_current_after(); $page_title = get_the_title(); $blog_title = get_the_title( get_option( 'page_for_posts', true ) ); if ( ! is_404() ) { $post_parent = $post->post_parent; } else { $post_parent = ''; } if ( X_WOOCOMMERCE_IS_ACTIVE ) { $shop_url = x_get_shop_link(); $shop_title = x_get_option( 'x_' . $stack . '_shop_title' ); $shop_link = '<a href="'. $shop_url .'">' . $shop_title . '</a>'; } echo '<div class="x-breadcrumbs">' . $gamepad . '<a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter; if ( is_home() ) { echo $current_before . $blog_title . $current_after; } elseif ( is_category() ) { $the_cat = get_category( get_query_var( 'cat' ), false ); if ( $the_cat->parent != 0 ) echo get_category_parents( $the_cat->parent, TRUE, $delimiter ); echo $current_before . single_cat_title( '', false ) . $current_after; } elseif ( x_is_product_category() ) { if ( $is_ltr ) { echo $shop_link . $delimiter . $current_before . single_cat_title( '', false ) . $current_after; } else { echo $current_before . single_cat_title( '', false ) . $current_after . $delimiter . $shop_link; } } elseif ( x_is_product_tag() ) { if ( $is_ltr ) { echo $shop_link . $delimiter . $current_before . single_tag_title( '', false ) . $current_after; } else { echo $current_before . single_tag_title( '', false ) . $current_after . $delimiter . $shop_link; } } elseif ( is_search() ) { echo $current_before . __( 'Search Results for ', '__x__' ) . '“' . get_search_query() . '”' . $current_after; } elseif ( is_singular( 'post' ) ) { if ( get_option( 'page_for_posts' ) == is_front_page() ) { echo $current_before . $page_title . $current_after; } else { if ( $is_ltr ) { echo '<a href="' . get_permalink( get_option( 'page_for_posts' ) ) . '">' . $blog_title . '</a>' . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . get_permalink( get_option( 'page_for_posts' ) ) . '">' . $blog_title . '</a>'; } } } elseif ( x_is_portfolio() ) { echo $current_before . get_the_title() . $current_after; } elseif ( x_is_portfolio_item() ) { $link = x_get_parent_portfolio_link(); $title = x_get_parent_portfolio_title(); if ( $is_ltr ) { echo '<a href="' . $link . '">' . $title . '</a>' . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . $link . '">' . $title . '</a>'; } } elseif ( x_is_product() ) { if ( $is_ltr ) { echo $shop_link . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . $shop_link; } } elseif ( x_is_buddypress() ) { if ( bp_is_group() ) { echo '<a href="' . bp_get_groups_directory_permalink() . '">' . x_get_option( 'x_buddypress_groups_title' ) . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after; } elseif ( bp_is_user() ) { echo '<a href="' . bp_get_members_directory_permalink() . '">' . x_get_option( 'x_buddypress_members_title' ) . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after; } else { echo $current_before . x_buddypress_get_the_title() . $current_after; } } elseif ( x_is_bbpress() ) { remove_filter( 'bbp_no_breadcrumb', '__return_true' ); if ( bbp_is_forum_archive() ) { echo $current_before . bbp_get_forum_archive_title() . $current_after; } else { echo bbp_get_breadcrumb(); } add_filter( 'bbp_no_breadcrumb', '__return_true' ); } elseif ( is_page() && ! $post_parent ) { echo $current_before . $page_title . $current_after; } elseif ( is_page() && $post_parent ) { $parent_id = $post_parent; $breadcrumbs = array(); if ( is_rtl() ) { echo $current_before . $page_title . $current_after . $delimiter; } while ( $parent_id ) { $page = get_page( $parent_id ); $breadcrumbs[] = '<a href="' . get_permalink( $page->ID ) . '">' . get_the_title( $page->ID ) . '</a>'; $parent_id = $page->post_parent; } if ( $is_ltr ) { $breadcrumbs = array_reverse( $breadcrumbs ); } for ( $i = 0; $i < count( $breadcrumbs ); $i++ ) { echo $breadcrumbs[$i]; if ( $i != count( $breadcrumbs ) -1 ) echo $delimiter; } if ( $is_ltr ) { echo $delimiter . $current_before . $page_title . $current_after; } } elseif ( is_tag() ) { echo $current_before . single_tag_title( '', false ) . $current_after; } elseif ( is_author() ) { GLOBAL $author; $userdata = get_userdata( $author ); echo $current_before . __( 'Posts by ', '__x__' ) . '“' . $userdata->display_name . $current_after . '”'; } elseif ( is_404() ) { echo $current_before . __( '404 (Page Not Found)', '__x__' ) . $current_after; } elseif ( is_archive() ) { if ( x_is_shop() ) { echo $current_before . $shop_title . $current_after; } else { echo $current_before . __( 'Archives ', '__x__' ) . $current_after; } } echo '</div>'; } } // =============================================================================Please get the raw code here (http://pastebin.com/58mfC3c8) to preserved the Unicode Html Entity or the data-x-icon value.
We would loved to know if this has work for you. Thank you.
December 3, 2016 at 2:56 am #1279683
khomikoParticipantOk, the first one definitely did not work. The second one had one flaw that I figured out.
Instead of using:
$gamepad = ‘‘ . do_shortcode(‘[x_icon type=”gamepad”]’) . ‘‘ . x_get_breadcrumb_delimiter();
I took out the
. x_get_breadcrumb_delimiter();
and now it works beautifully. I’m going to see if I can add more icons in to create a sort of menu. I really appreciate the help. You’re awesome.
Final code for anyone else who wants to do this was
// Custom Breadcrumb // ============================================================================= function x_breadcrumbs() { if ( x_get_option( 'x_breadcrumb_display' ) ) { GLOBAL $post; $is_ltr = ! is_rtl(); $stack = x_get_stack(); $delimiter = x_get_breadcrumb_delimiter(); $home_text = x_get_breadcrumb_home_text(); $gamepad = '<a href="http://ix3gaming.com/groups/">' . do_shortcode('[x_icon type="gamepad"]') . '</a>'; $home_link = home_url(); $current_before = x_get_breadcrumb_current_before(); $current_after = x_get_breadcrumb_current_after(); $page_title = get_the_title(); $blog_title = get_the_title( get_option( 'page_for_posts', true ) ); if ( ! is_404() ) { $post_parent = $post->post_parent; } else { $post_parent = ''; } if ( X_WOOCOMMERCE_IS_ACTIVE ) { $shop_url = x_get_shop_link(); $shop_title = x_get_option( 'x_' . $stack . '_shop_title' ); $shop_link = '<a href="'. $shop_url .'">' . $shop_title . '</a>'; } echo '<div class="x-breadcrumbs">' . $gamepad . '<a href="' . $home_link . '">' . $home_text . '</a>' . $delimiter; if ( is_home() ) { echo $current_before . $blog_title . $current_after; } elseif ( is_category() ) { $the_cat = get_category( get_query_var( 'cat' ), false ); if ( $the_cat->parent != 0 ) echo get_category_parents( $the_cat->parent, TRUE, $delimiter ); echo $current_before . single_cat_title( '', false ) . $current_after; } elseif ( x_is_product_category() ) { if ( $is_ltr ) { echo $shop_link . $delimiter . $current_before . single_cat_title( '', false ) . $current_after; } else { echo $current_before . single_cat_title( '', false ) . $current_after . $delimiter . $shop_link; } } elseif ( x_is_product_tag() ) { if ( $is_ltr ) { echo $shop_link . $delimiter . $current_before . single_tag_title( '', false ) . $current_after; } else { echo $current_before . single_tag_title( '', false ) . $current_after . $delimiter . $shop_link; } } elseif ( is_search() ) { echo $current_before . __( 'Search Results for ', '__x__' ) . '“' . get_search_query() . '”' . $current_after; } elseif ( is_singular( 'post' ) ) { if ( get_option( 'page_for_posts' ) == is_front_page() ) { echo $current_before . $page_title . $current_after; } else { if ( $is_ltr ) { echo '<a href="' . get_permalink( get_option( 'page_for_posts' ) ) . '">' . $blog_title . '</a>' . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . get_permalink( get_option( 'page_for_posts' ) ) . '">' . $blog_title . '</a>'; } } } elseif ( x_is_portfolio() ) { echo $current_before . get_the_title() . $current_after; } elseif ( x_is_portfolio_item() ) { $link = x_get_parent_portfolio_link(); $title = x_get_parent_portfolio_title(); if ( $is_ltr ) { echo '<a href="' . $link . '">' . $title . '</a>' . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . '<a href="' . $link . '">' . $title . '</a>'; } } elseif ( x_is_product() ) { if ( $is_ltr ) { echo $shop_link . $delimiter . $current_before . $page_title . $current_after; } else { echo $current_before . $page_title . $current_after . $delimiter . $shop_link; } } elseif ( x_is_buddypress() ) { if ( bp_is_group() ) { echo '<a href="' . bp_get_groups_directory_permalink() . '">' . x_get_option( 'x_buddypress_groups_title' ) . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after; } elseif ( bp_is_user() ) { echo '<a href="' . bp_get_members_directory_permalink() . '">' . x_get_option( 'x_buddypress_members_title' ) . '</a>' . $delimiter . $current_before . x_buddypress_get_the_title() . $current_after; } else { echo $current_before . x_buddypress_get_the_title() . $current_after; } } elseif ( x_is_bbpress() ) { remove_filter( 'bbp_no_breadcrumb', '__return_true' ); if ( bbp_is_forum_archive() ) { echo $current_before . bbp_get_forum_archive_title() . $current_after; } else { echo bbp_get_breadcrumb(); } add_filter( 'bbp_no_breadcrumb', '__return_true' ); } elseif ( is_page() && ! $post_parent ) { echo $current_before . $page_title . $current_after; } elseif ( is_page() && $post_parent ) { $parent_id = $post_parent; $breadcrumbs = array(); if ( is_rtl() ) { echo $current_before . $page_title . $current_after . $delimiter; } while ( $parent_id ) { $page = get_page( $parent_id ); $breadcrumbs[] = '<a href="' . get_permalink( $page->ID ) . '">' . get_the_title( $page->ID ) . '</a>'; $parent_id = $page->post_parent; } if ( $is_ltr ) { $breadcrumbs = array_reverse( $breadcrumbs ); } for ( $i = 0; $i < count( $breadcrumbs ); $i++ ) { echo $breadcrumbs[$i]; if ( $i != count( $breadcrumbs ) -1 ) echo $delimiter; } if ( $is_ltr ) { echo $delimiter . $current_before . $page_title . $current_after; } } elseif ( is_tag() ) { echo $current_before . single_tag_title( '', false ) . $current_after; } elseif ( is_author() ) { GLOBAL $author; $userdata = get_userdata( $author ); echo $current_before . __( 'Posts by ', '__x__' ) . '“' . $userdata->display_name . $current_after . '”'; } elseif ( is_404() ) { echo $current_before . __( '404 (Page Not Found)', '__x__' ) . $current_after; } elseif ( is_archive() ) { if ( x_is_shop() ) { echo $current_before . $shop_title . $current_after; } else { echo $current_before . __( 'Archives ', '__x__' ) . $current_after; } } echo '</div>'; } } // =============================================================================December 3, 2016 at 2:57 am #1279685
khomikoParticipantAgain, thank you a lot for the help. It really makes the flow for the website much better 🙂
December 3, 2016 at 3:17 am #1279697
ChristopherModeratorYou’re welcome.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1279428 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
