New Landing How can we help? Cardinal Rename show all portfolio category

Viewing 15 posts - 1 through 15 (of 19 total)
  • Posted in: Cardinal
  • #145402
    Lars
    Member
    Post count: 91

    Hello,

    how is it possible to rename the »show all« in the portfolio category filter?

    For example: »show all« to »all«

    Best Regards
    Lars

    #145416
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    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

    #151565
    Lars
    Member
    Post count: 91

    Hey Kyle,

    when I use your code the renaming works.

    But the all categories are not visible.

    Best Regards
    Lars

    #151599
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    So if you remove the code, the categories are visible, but if you add the code they are not?

    – Kyle

    #151659
    Lars
    Member
    Post count: 91

    Correct.

    #151691
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Ok then maybe the wording has to be ‘show all’ for it to work.

    – Kyle

    #152635
    Lars
    Member
    Post count: 91

    Is there no way to rename it?

    – Lars

    #152636
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Try using codestyle localization to translate the string

    – Kyle

    #152877
    Lars
    Member
    Post count: 91

    I installed Codestyling Localization. Searched for the words. But cant find it.

    Do you have another idea?

    – Lars

    #152939
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    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
    Mohammad

    #155878
    Lars
    Member
    Post count: 91

    Hi,

    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.
    #155889
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    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 );
    ?>
    #166621
    Nunes
    Member
    Post count: 203
    This reply has been marked as private.
    #166641
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    probably 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

    #167018
    Nunes
    Member
    Post count: 203

    Unfortunately it does not work , when you put your code the Web still collapsing.

Viewing 15 posts - 1 through 15 (of 19 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register