Ahh the old unexpected T_STRING error message.I’m familiar with causing this error, not fixing it.So I headed over to the Exec PHP plugin home page to sniff out some way of making it go away.
Keeping in mind that in one Page where I’d used the plugin to display a list of pages it worked just fine I read the terse explanation of why I might be getting this error:
If you experience a PHP error message like ‘Some error in /home/minime/htdocs/blog/wp-content
/plugins/exec-php/runtime.php(41) : eval()’d code on line 4′ then it’s time to repair your PHP code. If you are unsure where your code breaks, first run it in a separate file to punch out all bugs and afterwards copy the code into your article or widget. To reduce the noise in the comments section of the plugin homepage I will delete all entries refering to this topic.
Yikes.It’s totally my fault,then.So what did I do to cause the error? I used an apostrophe
in an array or string or whatever the kids like to call it.
I was using the wp list pages template tag I got from the WP Codex
[php]<ul>
<?php
wp_list_pages(‘include=5,9,23&title_li=<h2>’ . __(‘Poetry’) . ‘</h2>’ ); ?>
</ul>
[/php]
Except instead of (‘Poetry’) I’d written (‘Men‘s’) and the punctuation mark was what caused the error.
I re-worded the title and the error message went away and the code executed.
Oftentimes I’ve gotten errors for something as easy to fix as my last mistake.
The first assumption one might make is that it’s the plugin causing this error.But since it worked elsewhere I knew it couldn’t be the plugin’s fault.
So I deduced that it was code I’d altered (see above) — the other code I used I hadn’t altered.
I hope this helps someone else who gets the same error and hopefully it is as simple to mend.