Support » Plugins » Conditional page

  • thom667



    I basically removed the default sidebar.php code and wrote my own, which resides in /wordpress/wp-content/themes/starkers/sidebar.php

    Now, in the sidebar, I have a mailing list form whose ‘action’ file is called mlist.php which resides in /wordpress/mlist.php

    i.e. <form action=”/wordpress/mlist.php” method=”post”>…

    mlist.php takes the email address address inputted and decides whether or not to add it to a database and then gives appropriate output. But I want this output to blend in with my theme.

    So say I create a page:


    I want mlist.php do the following

    if (email address successfully added)
      output success message;
      output error message;

    But I want the messages to appear where “//CONDITIONAL STUFF GOES HERE” is above. I tried creating separate php pages and then using header() to redirect but something went wrong. For example, I created the file /wordpress/wp-content/themes/starkers/invalid_email.php and used the following redirect code in mlist.php:

    header ("Location: ".TEMPLATEPATH."/invalid_email.php);

    But this didn’t work and said that…/starkers/invalid_email.php didn’t exist. So obviously I don’t understand how wordpress structures these redirects.

    Another thing, is that creating a page for each output message seems like overkill for me. Is there a neater way to do what I want?

    Sorry for the long post, thanks for reading.

Viewing 2 replies - 1 through 2 (of 2 total)
  • thom667


    OK, thought I’d just encompass it all into mlist.php.


    // Email validation
    // and database queries
    // go here,
    // along with conditional output
    get_sidebar ();
    get_footer ();

    Now since I’m calling the get_*() functions, I’ll need to move mlist.php into the theme folder, yes? Well that’s what I did.

    Then I opened up sidebar.php and changed my form to <form action=”mlist.php” method=”post”> since mlist.php and sidebar.php reside in the same directory.
    This gave me an error when I submitted the form on my front page. So I changed it to action=”full/path/to/mlist.php”. Now I get an error “Call to undefined function get_header()”. How do I get this to work?




    Had to include wp-load.php.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional page’ is closed to new replies.