T
T
twentytvvo2020-07-05 05:43:00
WordPress
twentytvvo, 2020-07-05 05:43:00

How to output PHP variable in WordPress (Elementor)?

Hello! I will explain right away, you need to output the variables $a and $b as the value of the value attribute in input .
I also tried plugins that supposedly output php shortcodes and a method with output like [exec][/exec] , I also wrote shortcodes myself in function.php, tried many plugins to revive php somehow, but nothing helps, <?php echo $ a; ?> doesn't work and looks like <--?php echo $a; ?--> (not functional). I tried both in elementor the above, and in the standard Wordpress post editor.
Layout on Elementor initially.

...
$a = base64_encode( json_encode($arr));
$b = base64_encode( sha1($pk .$a .$pk, 1 ));
...


<form method="POST" action="сайт.ру/обработчик.php" >
<input type="hidden" name="a" value="<?php echo $a; ?>"/>
<input type="hidden" name="b" value="<?php echo $b; ?>"/>
<button type="submit" name="submit">Submit </button>
</form>


The question is quite urgent, but I have already spent a lot of time on solving it, so I turn to experts for help. Preferably some easier way.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
mipfikus, 2020-07-05
@mipfikus

Make your elementor widget

O
Orkhan Hasanli, 2020-07-05
@azerphoenix

Install the plugin https://ru.wordpress.org/plugins/insert-php-code-s...
and paste your PHP code and copy the shortcode into Elementor.
Another option - without a plugin, create your shortcode via add_shortcode and paste it into the editor

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question