WordPress.org

Ready to get started?Download WordPress

Forums

how to use php in WP (4 posts)

  1. gmdavis62
    Member
    Posted 8 years ago #

    I'm very new to WP. I created a second page on my test blog and I wanted to simply put some php on that page that will display content from a database based on some variables.

    I cannot figure out how to do this. I tried in the post editor (which I doubted would work) and all I get is the code displayed.

    As I search this forum, I see plenty of references to PHP code but I can't understand where I would put this in WP.

    Npw, if there is some file that is specific to that page, that would be a good place to start but if i want numerous references to that php code with different functions (like blog entries only with URL queries) how can I do this? Am I making sense?

  2. FruitFly
    Member
    Posted 8 years ago #

    I'm not entirely sure I understand what you're looking for, but I think you're wanting top execute PHP code from within a post or page...

    If that's the case, you'll want to take a look at plugins that can set this up for you, like RunPHP or Exec-PHP. There are likely lots of others if you poke around a bit. Without these plugins, you can't run PHP within the WP loop.

    If that's not what you're trying to do... then I'm confused and this probably doesn't help at all. :)

  3. gmdavis62
    Member
    Posted 8 years ago #

    That IS what I'm trying to do. Thanks! I'll look into the plugins.

  4. spencerp
    Member
    Posted 8 years ago #

    FruitFly has posted the right stuff to use, plugin wise to be able to use or run PHP within a page. You would then just add the php call tags for whatever you want to display while on the Write Page, post screen. Download RunPHP, which is my suggestion.

    Install that plugin, then when in the Write Page part of control panel...put a check in the: eval() Content

    part of the Discussion option. Then place whatever "php call tag code" in the window. I did this for my Clean Archives page plugin..

    spencerp

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags