Digital experiences for all disciplines
New Landing › How can we help? › Cardinal › Rename show all portfolio category
New Landing › How can we help? › Cardinal › Rename show all portfolio category
- This topic has 18 replies, 5 voices, and was last updated 9 years by Mohammad – SUPPORT.
-
Posted in: Cardinal
-
January 29, 2015 at 11:50 am #145402
Hello,
how is it possible to rename the »show all« in the portfolio category filter?
For example: »show all« to »all«
Best Regards
LarsJanuary 29, 2015 at 12:32 pm #145416Hi
Add this to your child theme’s functions.php file
/* PORTFOLIO FILTER ================================================== */ if ( ! function_exists( 'sf_portfolio_filter' ) ) { function sf_portfolio_filter( $style = "basic", $parent_category = "" ) { $filter_output = $tax_terms = ""; if ( $parent_category == "" || $parent_category == "All" ) { $tax_terms = sf_get_category_list( 'portfolio-category', 1 ); } else { $tax_terms = sf_get_category_list( 'portfolio-category', 1, $parent_category ); } $filter_output .= '<div class="filter-wrap clearfix">' . "\n"; $filter_output .= '<ul class="post-filter-tabs filtering clearfix">' . "\n"; $filter_output .= '<li class="all selected"><a data-filter="*" href="#"><span class="item-name">' . __( "All", "swiftframework" ) . '</span></a></li>' . "\n"; foreach ( $tax_terms as $tax_term ) { $term = get_term_by( 'slug', $tax_term, 'portfolio-category' ); if ( $term ) { $filter_output .= '<li><a href="#" title="' . $term->name . '" class="' . $term->slug . '" data-filter=".' . $term->slug . '"><span class="item-name">' . $term->name . '</span></a></li>' . "\n"; } else { $filter_output .= '<li><a href="#" title="' . $tax_term . '" class="' . $tax_term . '" data-filter=".' . $tax_term . '"><span class="item-name">' . $tax_term . '</span></a></li>' . "\n"; } } $filter_output .= '</ul></div>' . "\n"; return $filter_output; } }
– Kyle
February 19, 2015 at 12:31 pm #151565Hey Kyle,
when I use your code the renaming works.
But the all categories are not visible.
Best Regards
LarsFebruary 19, 2015 at 1:15 pm #151599So if you remove the code, the categories are visible, but if you add the code they are not?
– Kyle
February 19, 2015 at 3:03 pm #151659Correct.
February 19, 2015 at 4:40 pm #151691Ok then maybe the wording has to be ‘show all’ for it to work.
– Kyle
February 24, 2015 at 9:06 am #152635Is there no way to rename it?
– Lars
February 24, 2015 at 9:10 am #152636Try using codestyle localization to translate the string
– Kyle
February 24, 2015 at 8:49 pm #152877I installed Codestyling Localization. Searched for the words. But cant find it.
Do you have another idea?
– Lars
February 25, 2015 at 6:19 am #152939Hi,
Please remove the last code and paste this code at functions.php of child theme.<?php function sf_text_strings( $translated_text, $text, $domain ) { $translated_text = strtolower($translated_text); switch ( $translated_text ) { case 'show all' : $translated_text = __( 'All', 'woocommerce' ); break; } return $translated_text; } add_filter( 'gettext', 'sf_text_strings', 20, 3 ); ?>
Thanks
MohammadMarch 9, 2015 at 9:18 am #155878Hi,
this code works. But it changes all capital letters to lowercase. Also the WordPress-Backend got this change. So I removed this code. In the attachment are some screenshots.
Any help?
Attachments:
You must be logged in to view attached files.March 9, 2015 at 9:53 am #155889Hi,
Please remove that code and use this new code:-<?php function sf_text_strings( $translated_text, $text, $domain ) { //$translated_text = strtolower($translated_text); switch ( $translated_text ) { case 'Show all' : $translated_text = __( 'All', 'woocommerce' ); break; } return $translated_text; } add_filter( 'gettext', 'sf_text_strings', 20, 3 ); ?>
April 20, 2015 at 10:45 pm #166621This reply has been marked as private.April 21, 2015 at 12:31 am #166641probably because of the php open and close tags.
Try this one instead.function sf_text_strings( $translated_text, $text, $domain ) { //$translated_text = strtolower($translated_text); switch ( $translated_text ) { case 'Show all' : $translated_text = __( 'All', 'woocommerce' ); break; } return $translated_text; } add_filter( 'gettext', 'sf_text_strings', 20, 3 );
-Rui
April 21, 2015 at 10:22 pm #167018Unfortunately it does not work , when you put your code the Web still collapsing.
-
Posted in: Cardinal
You must be logged in and have valid license to reply to this topic.