{"id":5266925,"date":"2014-09-07T14:01:56","date_gmt":"2014-09-07T14:01:56","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/problem-with-insert_php-and-shortcode\/"},"modified":"2016-08-22T01:15:06","modified_gmt":"2016-08-22T01:15:06","slug":"problem-with-insert_php-and-shortcode","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/problem-with-insert_php-and-shortcode\/","title":{"rendered":"Problem with insert_php and shortcode"},"content":{"rendered":"<p>When I insert shortcode into a page using the Insert PHP plugin, I am getting a Parse error:<\/p>\n<p>Code on page:<\/p>\n<p>[insert_php]<br \/>\necho do_shortcode(&#8216;[pdb_list filter=&#8221;user_login=&#8217; . $current_user-&gt;user_login . &#8216;&#8221;]&#8217;);<br \/>\n[\/insert_php]<\/p>\n<p>Page output:<\/p>\n<p>Parse error: syntax error, unexpected \u2018&amp;\u2019 in \/home\/content\/01\/12721101\/html\/CAG\/wp-content\/plugins\/insert-php\/insert_php.php(48) : eval()\u2019d code on line 2<\/p>\n<p>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.<\/p>\n<p>[insert_php]<br \/>\necho do_shortcode(&#8220;[pdb_list filter=\\&#8221;user_login=&#8217;.$current_user-&gt;user_login.&#8217;\\&#8221;]&#8221;);<br \/>\n[\/insert_php]<\/p>\n<p>I have tried using \\&#8221; and \\&#8217; as a the first level quote and &#8221; &#8216; as the next 2 levels, but this does not work either:<\/p>\n<p>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()\u2019d code on line 2<\/p>\n<p>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?<\/p>\n<p>https:\/\/wordpress.org\/plugins\/insert-php\/<\/p>\n","protected":false},"template":"","class_list":["post-5266925","topic","type-topic","status-closed","hentry","topic-tag-parse-error","topic-tag-shortcode"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5266925","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/5266925\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=5266925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}