Forked from amboutwe/yoast_seo_breadcrumb_add_woo_shop.php
Last active
May 10, 2022 14:17
Revisions
-
thomasfromwood revised this gist
May 10, 2022 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,6 @@ function yoast_seo_breadcrumb_add_blog_link( $links ) { $blogPage__title = get_the_title($blogPage__id); $blogPage__permalink = get_permalink($blogPage__id); //add blog link only if post for category archive page if ( is_category() && get_post_type() == 'post'): @@ -31,5 +30,6 @@ function yoast_seo_breadcrumb_add_blog_link( $links ) { endif; return $links; } -
thomasfromwood revised this gist
May 10, 2022 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,9 +5,9 @@ * Last Tested: May 10 2022 using Yoast SEO 18.8 on WordPress 5.9.3 */ add_filter( 'wpseo_breadcrumb_links', 'yoast_seo_breadcrumb_add_blog_link' ); function yoast_seo_breadcrumb_add_blog_link( $links ) { //get global post informations global $post; -
thomasfromwood revised this gist
May 10, 2022 . No changes.There are no files selected for viewing
-
thomasfromwood revised this gist
May 10, 2022 . 4 changed files with 35 additions and 91 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ <?php /* * Add blog link on category archive page to the Yoast SEO breadcrumbs * Credit: https://gist.github.com/amboutwe/ea0791e184668a5c7bd7bbe357c598e9#file-yoast_seo_breadcrumb_append_link-php * Last Tested: May 10 2022 using Yoast SEO 18.8 on WordPress 5.9.3 */ add_filter( 'wpseo_breadcrumb_links', 'yoast_seo_breadcrumb_append_link' ); function yoast_seo_breadcrumb_append_link( $links ) { //get global post informations global $post; //get the blog page informations $blogPage__id = get_option( 'page_for_posts' ); $blogPage__title = get_the_title($blogPage__id); $blogPage__permalink = get_permalink($blogPage__id); //add blog link only if post for category archive page if ( is_category() && get_post_type() == 'post'): //customize breakcrumb $breadcrumb[] = array( 'url' => $blogPage__permalink, 'text' => $blogPage__title, ); array_splice( $links, 1, -2, $breadcrumb ); endif; return $links; } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,25 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,36 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,30 +0,0 @@ -
amboutwe revised this gist
Feb 25, 2019 . No changes.There are no files selected for viewing
-
amboutwe revised this gist
Feb 25, 2019 . 1 changed file with 30 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ <?php /********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ /* * Add a link to the Yoast SEO breadcrumbs * Credit: Yoast team * Last Tested: Feb 25 2019 using Yoast SEO 9.6 on WordPress 5.1 ********* * DIFFERENT POST TYPES * Post: Change 123456 to the post ID * Page: Change is_single to is_page and 123456 to the page ID * Custom Post Type: Change is_single to is_singular and 123456 to the 'post_type_slug' Example: is_singular( 'cpt_slug' ) ********* * MULTIPLE ITEMS * Multiple of the same type can use an array. Example: is_single( array( 123456, 234567, 345678 ) ) * Multiple of different types can repeat the if statement */ add_filter( 'wpseo_breadcrumb_links', 'wpseo_breadcrumb_remove_limited' ); function wpseo_breadcrumb_remove_limited( $breadcrumbs ) { if ( is_single ( 123456 ) ) { return false; } else { return $breadcrumbs; } } -
amboutwe revised this gist
Nov 30, 2018 . 1 changed file with 36 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ <?php /********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ /* * Add a link to the Yoast SEO breadcrumbs * Credit: https://wordpress.stackexchange.com/users/8495/rjb * Last Tested: Nov 30 2018 using Yoast SEO 9.2 on WordPress 4.9.8 ********* * DIFFERENT POST TYPES * Post: Change 123456 to the post ID * Page: Change is_single to is_page and 123456 to the page ID * Custom Post Type: Change is_single to is_singular and 123456 to the 'post_type_slug' Example: is_singular( 'cpt_slug' ) ********* * MULTIPLE ITEMS * Multiple of the same type can use an array. Example: is_single( array( 123456, 234567, 345678 ) ) * Multiple of different types can repeat the if statement */ add_filter( 'wpseo_breadcrumb_links', 'yoast_seo_breadcrumb_append_link' ); function yoast_seo_breadcrumb_append_link( $links ) { global $post; if ( is_single ( 123456 ) ) { $breadcrumb[] = array( 'url' => site_url( '/blog/' ), 'text' => 'Blog', ); array_splice( $links, 1, -2, $breadcrumb ); } return $links; } -
amboutwe renamed this gist
Jun 17, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
amboutwe renamed this gist
Jun 17, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
amboutwe renamed this gist
Jun 17, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
amboutwe renamed this gist
Jun 17, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
amboutwe revised this gist
Jun 8, 2017 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ <?php /********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ /* * Add shop link to the Yoast SEO breadcrumbs for a WooCommerce shop page. -
amboutwe revised this gist
Apr 20, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ <?php /* * Add shop link to the Yoast SEO breadcrumbs for a WooCommerce shop page. * Credit: https://wordpress.stackexchange.com/users/8495/rjb * Last Tested: Apr 20 2017 using Yoast SEO 4.6 on WordPress 4.7.3 */ -
amboutwe created this gist
Apr 20, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ <?php /* * Remove a link from the Yoast SEO breadcrumbs * Credit: https://wordpress.stackexchange.com/users/8495/rjb * Last Tested: Apr 20 2017 using Yoast SEO 4.6 on WordPress 4.7.3 */ add_filter( 'wpseo_breadcrumb_links', 'wpseo_breadcrumb_add_woo_shop_link' ); function wpseo_breadcrumb_add_woo_shop_link( $links ) { global $post; if ( is_woocommerce() ) { $breadcrumb[] = array( 'url' => get_permalink( woocommerce_get_page_id( 'shop' ) ), 'text' => 'Shop', ); array_splice( $links, 1, -2, $breadcrumb ); } return $links; }