WordPress.org

Ready to get started?Download WordPress

Forums

Using PHP in WordPress (22 posts)

  1. keenanwl
    Member
    Posted 3 years ago #

    I would like to build a few .php pages in order to process a form and then present API errors and thank-yous. Is that possible on the WP CMS? What would I need to do in order to make that happen?

    As an alternative solution, I would like to process a form wholly within a WordPress page. Is it possible to have wordpress php functions and other php notation on the same page? For example, may I start a session before the header is called?

  2. keenanwl
    Member
    Posted 3 years ago #

    I just wanted to note the error that I got:

    Fatal error: Call to undefined function get_header() in /home/afalik/globalcitizenyear.org/wp-content/themes/deMar/DoDirectPaymentReceipt.php on line 83

    The get_header() function is the first problem but I can't think why that would be undefined?

  3. kapilj
    Member
    Posted 3 years ago #

    It seems that you are calling the .php page directly. To use WordPress functions you have to include "wp_load.php" file exists in the WordPress root directory.

    The better option is use custom page template (http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates)

    Thanks!

  4. jgomezgarcia
    Member
    Posted 3 years ago #

    Hi there, every one.
    I use a plug-in called PHP Exec.

    In every page I want to include php code, I write this:
    <phpcode>
    <?php
    (...)
    ?>
    </phpcode>

    And it works... ;)

    Best regards.

  5. jgomezgarcia
    Member
    Posted 3 years ago #

    Ooops...

    Sorry about that.

    The link to the plugin's web:
    http://priyadi.net/archives/2005/03/02/wordpress-php-exec-plugin/

    Best regads.

  6. xxbossmanxx
    Member
    Posted 3 years ago #

    php exec can lead to security issues tho.

  7. sterex
    Member
    Posted 3 years ago #

    Hi keenanwl,

    The best way to do this is to create page templates based on your wordpress theme. Customize the page template however you want with your custom PHP code.

    Now create a page in wordpress using that page template. That should do the trick.

    If you need more info, do ask.

    Here are a few links:
    >> http://www.davidrisley.com/how-to-custom-page-template-wordpress/
    >> http://codex.wordpress.org/Pages#Page_Templates

    Regards,
    Sterex

  8. Luke America
    Member
    Posted 3 years ago #

    Page templates is the way to go ... and very easy to implement ... plus they're re-usable. I agree completely with sterex.

  9. agedcareaid
    Member
    Posted 3 years ago #

    Hi Guys,

    My youtube video link is not shwing up on my Home page.

    Pls Pls help me.

    I dont know what I am doing wrong.

    Pls log in to : http://www.agedcareaid.com.au can u will see " page cannot be displayed" error - some issues with how i hv pasted the code.

    Can someone pls put me in the rite direction?

    Thanks an Thanks tons
    Phyllys

  10. Luke America
    Member
    Posted 3 years ago #

    @agedcareaid:

    Your video URL is malformed. Instead of this:

    http://www.youtube.com/embed/http://www.youtube.com/embed/Nvb4fxRzQw4

    Use this link:

    http://www.youtube.com/watch?v=Nvb4fxRzQw4

  11. agedcareaid
    Member
    Posted 3 years ago #

    Thank you Luke

    It's still not working :(

    i dont knw where I am going wrong....

    Thanks tons
    Phyllys

  12. Luke America
    Member
    Posted 3 years ago #

    Try using this for the link beneath the video:

    http://www.youtube.com/watch?v=Nvb4fxRzQw4

    And, use this code for the iframe (paste it as HTML):

    <iframe title="YouTube video player" width="640" height="390" src="http://www.youtube.com/embed/Nvb4fxRzQw4" frameborder="0" allowfullscreen></iframe>

    You currently have extraneous data in your URLs.

  13. Joey Kudish
    Member
    Posted 3 years ago #

    As other said, page templates is the way to go

  14. agokeren
    Member
    Posted 3 years ago #

    You can use this....

    <?php
    define(‘WP_USE_THEMES’, false);
    require(‘./wp-blog-header.php’);
    ?>

    for header

    <?php include (TEMPLATEPATH . ‘/header.php’); ?>

    for sidebar

    <?php include (TEMPLATEPATH . ‘/sidebar.php’); ?>

    for footer

    <?php include (TEMPLATEPATH . ‘/footer.php’); ?>
  15. askwhyweb
    Member
    Posted 3 years ago #

    Hi there all,

    i am looking for some function using which the default user registeration pattern can be changed, i.e. when new user try to create a user by default wordpress ask a username and email. and sends the password to the user given email.

    i need to have function to enter their password manually rather then randomly generated password

    My question how to sort this out? Does WordPress have any quick edit for this rather than changing wp-login.php to get this functionality.

    Shall be very thankful.
    I had posted this question in "How to and troubleshoot" but no buddy answered it.

    Regards,
    Farhan Islam

  16. wp-fresher
    Member
    Posted 3 years ago #

    Guys i am fresher for WordPress
    i am trying to redirect page to otherpage
    but in i am not getting any page name in URL only some codes

    i checked this
    http://pllcsrv/pllctest/wp-admin/options-permalink.php
    Permalink Settings here also they gave some codes only.

    how to get page name to use in "a herf " tag

    or any other option to redirect.

    plz help me guys.

  17. illuminatus7
    Member
    Posted 3 years ago #

    @wp-fresher, you can use get_permalink() function to get the URL of the page that you want by the following manner: -
    1) First get the page id from its title/ slug
    2) Store the page id in a variable.
    3) Pass this variable as an argument into the get_permalink() function.

    You can check out the code here http://pastebin.com/MPjaZpSK

  18. Nyl Stanton
    Member
    Posted 3 years ago #

    Can sombody please help...
    I accidently deleted my entire .htaccess file after editing a 301 redirect. I clicked the wrong button. now i have a new .htaccess file and I dont know how to edit it, I dont know exactly what should be there or how to format it. I dont anything about it. Meanwhile my website is now just a white page. Im using the twenty eleven theme if that helps at all. Please Help...

  19. th77409
    Member
    Posted 3 years ago #

    Is there any way to pass variables from the post into the template? I'm using the PHP Exec plugin, and I'd like to use the post field to pass a bunch of variables into my content-single.php until I get my SQL database running. Any clues?

  20. Kulkarni
    Member
    Posted 2 years ago #

    Use the wordpress extension. Save it through wordperss php extension it will work.

  21. Passagens Aereas
    Member
    Posted 2 years ago #

    Im looking for the same solution... same problem in http://depoimentosdeamor.org but it is working now... In my new blog http://passagensaereaspara.com.br i think my theme is broken...

  22. j.calosor
    Member
    Posted 2 years ago #

    seems like i need to post replies on posts before i can post my own topic?

Topic Closed

This topic has been closed to new replies.

About this Topic