I am a little confused. WP requires PHP, so it can’t be disabled or WP would not run. The echo $_GET should work.
Thanks. OK .. WordPress is the thing I’m unfamiliar with, so here’s what I’m doing:
Editing a page in HTML mode, I’m inserting
<p><?php echo “Hello “.$_GET[‘a’]; ?></p>
That saves OK and doesn’t rip out the PHP bit, then I run the page, and what’s output is:
<p><?php echo “Hello “.$_GET[‘a’]; ?></p>
In other words, it’s not being interpreted.
I know I can put PHP in the template, but I need it here in the page so I can pass these parameters in a hidden form field.
Cheers
J
OK, WP does not execute PHP inside posts. It is dangerous to do so because a poster can hack your site using that.
But, if you really need it, check out the Exec PHP plugin.
Does WP provide another way to use the $_GET data within a post? Is there, for instance, a WP variable I can use that provides it?
Or let me ask: if you wanted to pass a variable to a WordPress page, how would you do it? Eg. let’s say you wanted a WordPress page to display a photograph, but wanted to pass the filename? (Actually, I’ve done that with code in the template, but if you needed it in the body).
Or is it just that I need to put all my form into the header to solve my problem?
J
If you want to show a different picture on different pages, you can use a Custom Field to contain the URL of the picture.
AFAIK, there is no built-in way to access the $_GET data inside of the post content. You should be able to add a shortcode to display the picture. For details, see the links below:
Codex: Shortcode API
Smashing Magazine: Mastering WordPress Shortcodes. See especially example 6. Get the Last Image Attached to a Post.