2012-08-06, 02:15:41
This is code that I work with to be able to implement PAGE SHORTCODES. When I start adding SHORTCODES I realize that code:
Work only with page $content variable. So it wasn't possible to add shortcodes in template.
Modifications index.php:
And I call function :
I think this is cleanest solution, and could be implemented in core. In this way implementing caching system would be easy. And base functionality is not changed.
Code:
add_filter('content', 'FUNCTION_TO_CALL');
Work only with page $content variable. So it wasn't possible to add shortcodes in template.
Modifications index.php:
Code:
ob_start();
# include the template and template file set within theme.php and each page
if ( (!file_exists(GSTHEMESPATH .$TEMPLATE."/".$template_file)) || ($template_file == '') ) { $template_file = "template.php"; }
include(GSTHEMESPATH .$TEMPLATE."/".$template_file);
$data = ob_get_contents();
ob_clean();
exec_filter('page-content', $data);
And I call function :
Code:
add_filter('page-content', 'FUNCTION_TO_CALL');
I think this is cleanest solution, and could be implemented in core. In this way implementing caching system would be easy. And base functionality is not changed.