WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to setup a wrapper (6 posts)

  1. hardeeps
    Member
    Posted 5 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?

  2. MichaelH
    Member
    Posted 5 years ago #

    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/

  3. hardeeps
    Member
    Posted 5 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?

  4. whooami
    Member
    Posted 5 years ago #

    how do I accept the GET parameter?

    if($_GET["abc"] == "xyz") ...

  5. mrmist
    Forum Janitor
    Posted 5 years ago #

    Remember also to check isset or not empty to avoid PHP debug notices..

  6. hardeeps
    Member
    Posted 5 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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.