• Resolved rubbeldiekatz

    (@rubbeldiekatz)


    Greetings
    I want to display the total number of products in bold.

    I copied the result-count.php file into my child theme. And tried the line with
    of%3$d result
    to edit.
    But if I do that
    of %3$d result
    The Translator stops responding. It is then in English instead of German.

    Or can I just render the output only of $total somehow in bold?

    Thank you

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support con

    (@conschneider)

    Engineer

    Hi there,

    > Or can I just render the output only of $total somehow in bold?

    We can try to provide some custom CSS for that. We need to examine your cart / checkout via our browser but I did not see a way to quickly add a product to cart for testing with the custom form you have in place.

    Alternatively you can try this: https://www.ads-software.com/plugins/real-time-find-and-replace

    **Before you do that, please do make a full backup!**

    Kind regards,

    Thread Starter rubbeldiekatz

    (@rubbeldiekatz)

    hi

    Output Code from WooCommerce:
    <p class=”woocommerce-result-count”>Ergebnisse 1 – 12 von 1230 werden angezeigt</p>

    I want only change the total results in bold.
    That means i would have to add html code to the output.

    corsonr

    (@corsonr)

    Automattic Happiness Engineer

    Hi,

    That means i would have to add html code to the output.

    If you want only this “1 – 12 von 1230” to be in bold, then yes you have will have to use PHP and a filter to do so.

    Thread Starter rubbeldiekatz

    (@rubbeldiekatz)

    Hi

    No only this 1230.
    The total number.

    thx

    • This reply was modified 4 years, 7 months ago by rubbeldiekatz.
    corsonr

    (@corsonr)

    Automattic Happiness Engineer

    Hi,

    In your custom result-count.php you can try this:

    printf( _n( 'Showing all %d result', 'Showing all <b>%d</b> results', $total, 'woocommerce' ), $total );

    Thread Starter rubbeldiekatz

    (@rubbeldiekatz)

    Good Morning Remi

    I try this, but dosn’t work.

    The Code:

    if ( 1 === $total ) {
    		_e( 'Showing the single result', 'woocommerce' );
    	} elseif ( $total <= $per_page || -1 === $per_page ) {
    		/* translators: %d: total results */
    		printf( _n( 'Showing all %d result', 'Showing all %d results', $total, 'woocommerce' ), $total );
    	} else {
    		$first = ( $per_page * $current ) - $per_page + 1;
    		$last  = min( $total, $per_page * $current );
    		/* translators: 1: first result 2: last result 3: total results */
     		printf( _nx( 'Showing %1$d&ndash;%2$d of %3$d result', 'Showing %1$d&ndash;%2$d of %3$d results', $total, 'with first and last result', 'woocommerce' ), $first, $last, $total );
    	}

    I edit this Code:
    printf( _nx( 'Showing %1$d&ndash;%2$d of %3$d result', 'Showing %1$d&ndash;%2$d of %3$d results', $total, 'with first and last result', 'woocommerce' ), $first, $last, $total );

    to
    printf( _nx( 'Showing %1$d&ndash;%2$d of <b>%3$d</b> result', 'Showing %1$d&ndash;%2$d of <b>%3$d</b> results', $total, 'with first and last result', 'woocommerce' ), $first, $last, $total );

    But when I do that, is total result bold but the Translation no longer works.
    befor:
    Ergebnisse 1 – 12 von 1230 werden angezeigt
    after:
    Showing 1–12 of 1230 results

    When i edit this Code, then Display it in english. German dosn’t work.

    corsonr

    (@corsonr)

    Automattic Happiness Engineer

    Hey,

    It’s because you changed an existing string text and there’s no matching string anymore, so you need to translate this one. You can do so with either a free extension like Loco Translate or via the use of POEdit. You can learn more about how internationalization works here:

    https://docs.woocommerce.com/document/woocommerce-localization/

    Thread Starter rubbeldiekatz

    (@rubbeldiekatz)

    Hey

    thanks for the tip.

    I edited the woocommerce-de_DE.po with poedit and then copied / overwritten both files .po and .mo into the folder wp-content / languages ??/ plugins.
    It works.

    Another question.

    With the next update of woocommerce it will probably not work anymore.
    I created a child from Storefront where I have other changes in it.
    Where do I save the .po and .mo file in my child theme?

    corsonr

    (@corsonr)

    Automattic Happiness Engineer

    Hey,

    If your custom .po files are in wp-content/languages/ they will not be overwritten when you’ll update.

    Thread Starter rubbeldiekatz

    (@rubbeldiekatz)

    ok, thank you and happy holidays.

    corsonr

    (@corsonr)

    Automattic Happiness Engineer

    Thanks ??

    I’ll mark this as resolved for now. Have a lovely day ?? – take care!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘WooCommerce – Display total in bold’ is closed to new replies.