Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Page content hook suggestions
#1
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.
Reply


Messages In This Thread
Page content hook suggestions - by bogyvet - 2012-08-06, 02:15:41
Page content hook suggestions - by shawn_a - 2012-08-06, 05:23:43
Page content hook suggestions - by bogyvet - 2012-08-06, 17:12:09



Users browsing this thread: 2 Guest(s)