GetSimple Support Forum

Full Version: Page content hook suggestions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is code that I work with to be able to implement PAGE SHORTCODES. When I start adding SHORTCODES I realize that code:

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.
Why would you want to use short codes in templates when you can call php functions directly.
No sure I understand.
I didn't think about it. Why not ???

Forget Shortcodes. You can use caching system, code indentation fix and few more things with this.