Problem with insert_php and shortcode
-
When I insert shortcode into a page using the Insert PHP plugin, I am getting a Parse error:
Code on page:
[insert_php]
echo do_shortcode(‘[pdb_list filter=”user_login=’ . $current_user->user_login . ‘”]’);
[/insert_php]Page output:
Parse error: syntax error, unexpected ‘&’ in /home/content/01/12721101/html/CAG/wp-content/plugins/insert-php/insert_php.php(48) : eval()’d code on line 2
I can resolve the parse error by changing the multi-level quote structure (see below), but this coding does not allow the filtering to work.
[insert_php]
echo do_shortcode(“[pdb_list filter=\”user_login=’.$current_user->user_login.’\”]”);
[/insert_php]I have tried using \” and \’ as a the first level quote and ” ‘ as the next 2 levels, but this does not work either:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_STRING in /home/content/01/12721101/html/CAG/wp-content/plugins/insert-php/insert_php.php(48) : eval()’d code on line 2
The shortcode as originally written works fine when embedded directly into a custom template. Any suggestions for coding using Insert PHP to avoid having to create a custom template for each new theme I try?
The topic ‘Problem with insert_php and shortcode’ is closed to new replies.