hardeeps
Member
Posted 3 years ago #
Let us say, I create a new page under WordPress with the following content:
<IFRAME src="<?php echo "http://seeingwithc.org"; ?>"
scrolling="auto" frameborder="0">
[Your user agent does not support frames or is currently configured
not to display frames.]
</IFRAME>
It will not work, because I cannot have PHP content within a page. I want to parametrize which site will open within the iframe. I should be able to do this my creating a new php file in my theme, and having this IFRAME code in that php file. I can call get_header etc to create a rest of the page, similar to the other pages. How do I do this?
To put code in a page you either need to modify the template displaying that page or use a plugin that supports putting PHP in posts/pages.
Resources:
Pages
Stepping Into Template Tags
Stepping Into Templates
Template Hierarchy
http://wordpress.org/extend/plugins/exec-php/
hardeeps
Member
Posted 3 years ago #
I want to accept a GET parameter from the URL and then show content based on that in that PAGE. Even if I include some page specific code in the PHP that shows the page - how do I accept the GET parameter?
how do I accept the GET parameter?
if($_GET["abc"] == "xyz") ...
Remember also to check isset or not empty to avoid PHP debug notices..
hardeeps
Member
Posted 3 years ago #
Thanks all, I was able to get the code working. Esp the link on 'Template Hierarchy' helped. If someone needs help on how I did this, please contact me via my blog http://blog.hardeep.name.
Each time I make a code change to wordpress, I am amazed at how modular and pluggable it is.