Forums › Forums › Search & Filter Pro › Change currency symbol on custom archive file
- This topic has 7 replies, 2 voices, and was last updated 5 years, 8 months ago by
Trevor.
Viewing 8 posts - 1 through 8 (of 8 total)
-
Anonymous(Private) September 16, 2020 at 3:29 pm #259720
Hi,
I use your plugin and set up a archive file to show the output.
Now I want to change the WooCommerce currency symbol on the shortcode loaded inside this archive file but it not working.It does not recognize the chiptuning-archive.php file as template.
add_filter( 'woocommerce_currency_symbol', 'change_currency_symbol', 10, 2 ); function change_currency_symbol( $symbols, $currency ) { if ( is_page_template( 'archive-chiptuning.php' ) && ( 'EUR' === $currency )) { return ''; } return $symbols; }Any idea?
Trevor(Private) September 17, 2020 at 10:45 am #259892I think the issue is your use of the WordPress
is_page_template(), which will not do what you want.You need to use something like this:
https://wordpress.stackexchange.com/questions/10537/get-name-of-the-current-template-file
Anonymous(Private) September 17, 2020 at 7:12 pm #259958It has to do with the page template outside the loop. Solved my own problem;
add_filter( 'woocommerce_currency_symbol', 'change_currency_symbol', 10, 2 ); function change_currency_symbol( $symbols, $currency ) { global $template; if ( basename( $template ) === 'archive-chiptuning.php' && ( 'EUR' === $currency )) { return ''; } return $symbols; } -
AuthorPosts
Viewing 8 posts - 1 through 8 (of 8 total)