R
R
raigra2016-10-20 18:23:39
Parsing
raigra, 2016-10-20 18:23:39

How to display the exchange rate in a wordpress blog directly in the text, without a widget?

there is a blog on wordpress with visual composer
And since the layout was done entirely by his forces, there is no place for widgets, but there is a desire to parse the exchange rate and display it directly in text (for example, as an exact time script). How to implement it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
imsha, 2016-10-21
@raigra

wp has a mechanism https://codex.wordpress.org/Shortcode_API
Roughly speaking, you need to write a function that will register a new shortcode that you will insert anywhere in the editor, for example [exchange_rates].
To do this, add the following lines to functions.php:
function exchange_rates( $atts ) {
//Here you get the exchange rate from somewhere
return "result";
}
add_shortcode( 'exchange_rates', 'exchange_rates' );

N
Ninja Mate, 2016-10-20
@victorzadorozhnyy

Create a script that receives exchange rate data via api ajax. In the text, insert the Loading of the exchange rate... and for example, jQuery do the replacement by id.
This is one of the options.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question