WordPress.org

Ready to get started?Download WordPress

Forums

Write to php code (2 posts)

  1. anandselvaraj
    Member
    Posted 1 year ago #

    Hi All,

    How to write a php code in pages editor. Please share me...

  2. You really can't put PHP to execute using that editor.

    If you just want to display the code, there are many good syntax highlighters that make the code readable in a page or post.

    This is the one I use, there are many others.

    http://wordpress.org/extend/plugins/syntaxhighlighter/

    If that PHP code is for executing, you may want to create a custom page template.

    http://codex.wordpress.org/Stepping_Into_Templates

    Or if it's something more dynamic, try creating a shortcode so that the PHP gets executed when/where the shortcode is.

    http://codex.wordpress.org/Shortcode_API

Topic Closed

This topic has been closed to new replies.

About this Topic