Running php on WP posts and pages

2 replies
I have a snippet of php code that I would like to run on a WP blog page to establish a links page. Is there an easier way to do this. I have tried to use a couple of run php plugins but one blew up my site and another is so outdated that it is not compatible with WP 2.8. Any ideas?:confused:
#pages #php #posts #running
  • Profile picture of the author Steve Diamond
    Hi, Tony. I've done exactly that on several WP sites using Exec-PHP. Have you tried that one? I don't think I'm at the current WP version on any of those sites, though, so it may not work well. Also, if you look at some of the recent comments at the bottom of the page I linked to, you'll see that there seem to be some problems with the latest Exec-PHP release.

    The other thought I have, which I haven't tried, is to create a new template in your WP theme. Simply copy your page.php to another filename (e.g. linkpage.php) and insert the link page PHP code at an appropriate spot (inside the loop) in that file. Then assign that template to the links page when you create/edit it.

    That ought to work fine, but, as I said, I haven't tried it.

    HTH.

    Steve
    Signature
    Mindfulness training & coaching online
    Reduce stress | Stay focused | Keep positive and balanced
    {{ DiscussionBoard.errors[1136080].message }}
    • Profile picture of the author warfore
      ExecPhp is the plug in that caused me to have to reinstall my site (it caused the all WP admin links to want to open up in notepad) which was not fun. This did happen on WP 2.82.

      The template idea sounds like a good one so I will try that. Thanks for the info.
      Signature

      Regards,

      Tony

      {{ DiscussionBoard.errors[1136123].message }}

Trending Topics