WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] where to put custom php if using two themes (standard and mobile)? (3 posts)

  1. derekbeck
    Member
    Posted 1 year ago #

    Hi All,

    I created a dynamic php-driven newsletter page, which gives "hey, join my newsletter" by default, but the same page, depending on a variable passed in the URL, will also give things like "thanks for joining" or "you are now confirmed" or "sorry to see you unsubscribe".

    That page's code is in its own php file, and then I went into the core index.php of the (desktop) theme (Atahualpa) I'm using and forced that news php file to be called if the page being displayed was my newsletter page.

    Works great, no issues.

    But now, I have installed WPTouch for mobile users. Though it is a plugin, it is generating effectively its own theme for mobile users. The trouble is, now my newsletter page shows blank, because, indeed, the page as it stands in the WP database is blank, as it is only populated dynamically by the index.php for my desktop theme.

    Clearly, I need to populate this page in some fashion by using a file that is NOT part of my desktop theme, so that the mobile theme will render it as well.

    So, where do I put this call for my php code?

    The best solution would be to integrate it in a way so that I don't have to hard code it in every time something (like WP) updates. I do this now to integrate it into my ATA theme, but this is a pain. If it involves building it as a plugin, I've never done this, but would appreciate you pointing me in the right direction on how to.

    Thanks so much for reading my long post!

  2. derekbeck
    Member
    Posted 1 year ago #

    PS: If you want to see the page, it is: http://www.derekbeck.com/1775/newsletter/

  3. derekbeck
    Member
    Posted 1 year ago #

    Okay, the solution:

    I created a plugin http://codex.wordpress.org/Plugin_API

    used shortcode in the page itself to call on the action http://codex.wordpress.org/Shortcode_API

    works.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags