Using $_get inside a shortcode
-
I am new to this so bear with me ??
I am trying to use a url variable inside a shortcode on a page.
Let’s say my url is https://tralala.com/pouet/?youpi=meuhI am using tablepress and would like to have the output of the folowing shortcode displayed: [table id=x filter=”meuh” show_columns=”2,4,6″/]
I have looked around a bit and this seemed like the way to go:
<?php
$myvar = $_GET[‘youpi’];
echo do_shortcode(“[table id=x filter=’$myvar’ show_columns=’6′);
?>Unfortunately that code display the below text on the page:
$myvar = $_GET[‘youpi’];
do_shortcode(“[table id=7 filter=’$myvar’ show_columns=’4,5,6′);
?>It does not make sense to me at all why it would just display that.
Thanks in advance for your enlightening answers
- The topic ‘Using $_get inside a shortcode’ is closed to new replies.