Pass current currency into link
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page pleaseIf you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.
Quote from inputchipp on August 4, 2022, 23:30Hello, is there a way to pass the currently selected currency as a variable into a wordpress link?
Hello, is there a way to pass the currently selected currency as a variable into a wordpress link?
Quote from Pablo Borysenco on August 5, 2022, 11:12Hello
Yes, just add to your link ?currency=XXX
An example: https://demo.wp-currency.com/?currency=GBP
Hello
Yes, just add to your link ?currency=XXX
An example: https://demo.wp-currency.com/?currency=GBP
Quote from inputchipp on August 5, 2022, 21:40Hello, I think I did not explain my question very well.
I'm wanting to pass the currently selected currency into a link that is on my website. For example if GBP is selected, I want the button link on my website to be: domain.com/currency=GBP
If USD is selected, I want to have USD in the button link: domain.com/currency=USD
Is there a way to pass the currently selected currency as a variable inside a link?
Hello, I think I did not explain my question very well.
I'm wanting to pass the currently selected currency into a link that is on my website. For example if GBP is selected, I want the button link on my website to be: domain.com/currency=GBP
If USD is selected, I want to have USD in the button link: domain.com/currency=USD
Is there a way to pass the currently selected currency as a variable inside a link?
Quote from Pablo Borysenco on August 6, 2022, 10:50Hello
Sure, using PHP: https://wp-currency.com/function/wpcs-current_currency
Example: domain.com/currency=<?php global $WPCS; echo $WPCS->current_currency; ?>
For more API see please: https://wp-currency.com/codex
Hello
Sure, using PHP: https://wp-currency.com/function/wpcs-current_currency
Example: domain.com/currency=<?php global $WPCS; echo $WPCS->current_currency; ?>
For more API see please: https://wp-currency.com/codex
Quote from inputchipp on August 9, 2022, 09:41Hello, how do I implement this into my WordPress site? I am wanting to change the URL of a button to include the PHP variable $WPCS, is this possible?
Hello, how do I implement this into my WordPress site? I am wanting to change the URL of a button to include the PHP variable $WPCS, is this possible?
Quote from Pablo Borysenco on August 9, 2022, 11:56Hello
If you want to use dynamic content you can use PHP code. One moment, another idea: you can create custom shortcode and implement it into your content like: domain.com[my_wpcs]
Add please next code into file functions.php and use:
add_shortcode('my_wpcs', function () {
global $WPCS;
$tail = '';if ($WPCS->default_currency !== $WPCS->current_currency) {
$tail = '?currency=' . $WPCS->current_currency;
}return $tail;
});
Hello
If you want to use dynamic content you can use PHP code. One moment, another idea: you can create custom shortcode and implement it into your content like: domain.com[my_wpcs]
Add please next code into file functions.php and use:
add_shortcode('my_wpcs', function () {
global $WPCS;
$tail = '';
if ($WPCS->default_currency !== $WPCS->current_currency) {
$tail = '?currency=' . $WPCS->current_currency;
}
return $tail;
});
Quote from inputchipp on August 9, 2022, 22:05The shortcode method worked perfectly, thank you!
The shortcode method worked perfectly, thank you!
Quote from inputchipp on August 10, 2022, 11:22Hello again, I am trying to do something similar to the above, but it doesn't seem to be working, any idea why?
add_shortcode('usa_wpcs', function () { global $WPCS; $USA = ''; if ($WPCS == 'USD') { $USA = '&field_2[0]=10&options_2[0][0]'; } if ($WPCS == 'CAD') { $USA = '&field_62[0]=59&options_62[0][0]'; } if ($WPCS == 'AUD') { $USA = '&field_172[0]=113&options_172[0][0]'; } if ($WPCS == 'EUR') { $USA = '&field_99[0]=90&options_99[0][0]'; } if ($WPCS == 'GBP') { $USA = '&&field_134[0]=101&options_134[0][0]'; } return $USA; });
Hello again, I am trying to do something similar to the above, but it doesn't seem to be working, any idea why?
add_shortcode('usa_wpcs', function () {
global $WPCS;
$USA = '';
if ($WPCS == 'USD') {
$USA = '&field_2[0]=10&options_2[0][0]';
}
if ($WPCS == 'CAD') {
$USA = '&field_62[0]=59&options_62[0][0]';
}
if ($WPCS == 'AUD') {
$USA = '&field_172[0]=113&options_172[0][0]';
}
if ($WPCS == 'EUR') {
$USA = '&field_99[0]=90&options_99[0][0]';
}
if ($WPCS == 'GBP') {
$USA = '&&field_134[0]=101&options_134[0][0]';
}
return $USA;
});Quote from Pablo Borysenco on August 10, 2022, 11:55Hello
Please, for all comparisons use: $WPCS->current_currency
An example:
if ($WPCS->current_currency == 'USD') {
Hello
Please, for all comparisons use: $WPCS->current_currency
An example:
if ($WPCS->current_currency == 'USD') {