07 May 2007

Future-proof Your Custom WordPress Page

Here’s a silly way to create a future-proof custom WordPress Page. I usually depends on Custom Page Template rather than Default Page Template when creating a Page. The reason because some of the Pages that I created involves some extra PHP codes.

For those that didn’t know, WordPress doesn’t allows tags inside the content of your posts or pages unless with a help from a plugin like PHP-Exec. Basically the plugin will do the same thing but mine sort of more hardcore and future-proof.

You can create it as a Plugin by filling the additional Standard Plugin Information to the code snippet below:

function some_page($content) {

        if ( is_page('PAGE') ) {

                your PHP stuff here....

        } else {
                return $content;
        }
}

add_filter('the_content', 'some_page');

Note: Change PAGE with any supported parameter for is_page() Conditional Tag. Read WordPress Codex A PAGE Page for more information.

TrackBack URL

Leave a Reply