WordPress.org

Ready to get started?Download WordPress

Forums

Using Exec-PHP without disabling visual editor (4 posts)

  1. fredriley
    Blocked
    Posted 3 years ago #

    I suspect that I know the answer to this already ('no'), but just in case:

    Q: Can I use the Exec-PHP plugin to put code in posts/pages without disabling the visual editor? If not, is there another plugin which would enable PHP code in pages without disabling the editor?

    I'm after putting snippets of PHP code into pages and thought that the Exec-PHP plugin would do this, but after installing and enabling the plugin, then shoving the simple code:

    <?php echo date(); ?>

    in the HTML view of a page as a test, I got a message from the plugin:

    Saving this article will render all contained PHP code permanently unuseful

    Hmm. So I follow the link to what I should do, and get to the plugin docs which says I have to take 4 steps to enable code in a page, including disabling the WYSIWYG editor, which I don't want to do.

    I'm aware that I can write PHP code in templates, but occasionally it's handy to put a snippet in a particular page rather than a batch of pages. I'm also aware that I should be posting this query to the comments section of the plugin docs, but there are 84 unsearchable pages of comments and I don't want to plough through all of those, or add another comment and risk the author's wrath for not reading everything in sight :(

    Ta for any tips :)

    Fred

  2. tbradley22
    Member
    Posted 3 years ago #

    I'd love to hear an answer for this same question. Need to run php in pages/posts but client has to be able to use visual editor. Any hints?

  3. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    Need to run php in pages/posts

    what kind of php code?
    does the client need to add the code?

    consider to create and use shortcodes http://codex.wordpress.org/Shortcode_API

  4. tbradley22
    Member
    Posted 3 years ago #

    perfect. that was exactly what i was looking for. thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic