WordPress.org

Forums

The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Write to php code (2 posts)

  1. anandselvaraj
    Member
    Posted 4 years 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