Hi,
Can you show a sample code where you have difficulty? Maybe I can find a solution for this situation.
Best regards, Alex
Yes, I am having the same problem with incompatibility with other shortcodes that I use alongside [insert_php].
For example:
[insert_php] if ($Month == “” AND $Year == “”) {echo “[tdih_tab day= $Day]”; } else if …..
The [tdib_tab] shortcode won’t run in a php snippet. It just comes across as text.
I’ve tried for hours trying to find a workaround, but so far no luck.
PLEASE CONTINUE SUPPORTING the [insert_php] shortcode.
Thanks for a great plug-in.
Hi guys,
I’ll show you a new way how to do this with snippets.
Use the do_shortcode function to call the shortcode of someone else’s plugin in the snippet.
Example:
if ( is_user_logged_in() ) {
echo do_shortcode('[wbcr_php_snippet id="297"]');
} else {
echo "You must log in.";
}
Is it possible to share the value of a variable created in one PHP snippet to another PHP snippet on the same page?
Appreciate the do_shortcode suggestion. That solves one problem I was having. But I need to be able to share some variables.
@bjrnet21
Show your code, I’ll write, how it can be done with the help of snippets. While I do not quite understand what you mean.
SNIPPET #1
$Month = “”; $Day = “”; $Year = “”; $Month = $_GET[“Month”]; $Day = $_GET[“Day”]; $Year = $_GET[“Year”];
SNIPPET #2
echo “<input id=’myMonth’ style=’width: 110px;’ max=’12’ min=’1′ name=’Month’ type=’number’ value='”;echo $Month;echo”‘ />”;
SNIPPET #3 AND #4 AND SAME WITH DAY AND YEAR
SNIPPET #5
echo do_shortcode(‘[tdih month= $Month day= $Day year= $Year]’);
It appears that $Month $Day and $Year are not coming across. How do I pass variables into do_shortcode()?
I think I figured it out. I have to build the shortcode “string” and then pass it to the do_shortcode() function.
Example:
$tdih = “[tdih_tab month= ” . $Month . ” day= ” . $Day . ” year= ” . $Year . “]”;
echo do_shortcode($tdih);
Success! I was able to move all my instances of the old [insert_php] code over to the [wbcr_php_snippet id=”xxx”] format.
https://www.blackjackreview.com/wp/historical-events/tool/
Thank you for your support!
@bjrnet21
I am very glad to help you, if you have difficulties write, let me know. I think there are no problems that can not be solved. 🙂
Best regards, Alex
Great! With the use of do_shortcode everything works fine! Thanks for your tip!
-
This reply was modified 7 years, 11 months ago by
eckartschulz.