Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newb PHP in pages
#6
Some other possible options...

- Just insert code in your theme's template.php file (wherever you want it):

Code:
<?php
if (return_page_slug()=='page-with-php-code') {
    /* your code here */
}
?>

(Of course you can use if...else or switch...case... sentences, for several pages, different code, etc.)

- Another option is stuffing that code into a function, and call it using one of GetSimple's front-end hooks. Example:

Code:
<?php
add_action('content-top','my_php_code');

function my_php_code() {
    if (return_page_slug()=='page-with-php-code') {
        /* your code here */
        }
}
?>

This can be done either in your theme's functions.php file, or by creating your own custom plugin.

(The plugin option may be better because your code will be executed with any theme: no need to edit themes or copy the functions.php file.)


Messages In This Thread
Newb PHP in pages - by eru321 - 2010-10-29, 20:47:51
Newb PHP in pages - by Zegnåt - 2010-10-30, 00:48:22
Newb PHP in pages - by eru321 - 2010-10-30, 06:31:43
Newb PHP in pages - by Carlos - 2010-10-30, 18:55:34
Newb PHP in pages - by ccagle8 - 2010-10-30, 18:55:58
Newb PHP in pages - by Carlos - 2010-10-30, 19:02:28
Newb PHP in pages - by Carlos - 2010-10-30, 19:03:38
Newb PHP in pages - by ccagle8 - 2010-10-30, 20:43:20
Newb PHP in pages - by eru321 - 2010-10-30, 21:33:36
Newb PHP in pages - by yojoe - 2010-11-01, 03:39:42
Newb PHP in pages - by eru321 - 2010-11-02, 17:58:40



Users browsing this thread: 1 Guest(s)