RESOLVED How to use shortcode from another plugin in php snippet

Tigrou3838

New member
Messages
2
Likes
0
Points
1
#1
Hi,
I just switched from [insert_php] to a php snippet (with plugin Woody snippet)
But I cannot get the expected result.
I would like to insert php code in a page, but echoing a shortcode from another plugin (pdp personnal database) is not used,
when I use this code:

$sort = $_GET['sortby'];
if ( "$sort" == "" ) {
$sort = "no_affil";
}
$order="asc";
if ( "$sort" == "date_updated" ) {
$order="desc";
}
echo "[pdb_list template=club search='true' orderby='$sort' order='$order' fields='discipline,logo,no_affil,departement,url,email,contact,telephone,date_updated']";


I get the following on my page:

[pdb_list template=club search='true' orderby='no_affil' order='asc' fields='discipline,logo,no_affil,departement,url,email,contact,telephone,date_updated']


it shows that the php code is run successfully (variables $sort and $order are replaced) but shortcode "[pdb_list_template..]" is not interpreted.
Can you please help me finding the correct syntax for the php snippet code ?
 

Temyk

Developer & Support
Messages
1,129
Likes
42
Points
48
#2
Hello.

For these tasks there are in Wordpress function do_shortcode.

PHP:
do_shortcode("[pdb_list template=club search='true' orderby='$sort' order='$order' fields='discipline,logo,no_affil,departement,url,email,contact,telephone,date_updated']");
 

Tigrou3838

New member
Messages
2
Likes
0
Points
1
#3
Thanks a lot, with this, it works perfectly:
PHP:
echo(do_shortcode("[my_shortcode..]"));
best regards,
Tigrou3838