Plugin Directory


Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#667 closed enhancement (fixed)

Support init hook for geshi settings

Reported by: rmm5t Owned by: rmm5t
Priority: normal Severity: normal
Plugin: wp-syntax Keywords:


reedom had a great idea to incorporate an initialization hook to set geshi settings outside of wp-syntax.

Change History (3)

comment:1 @rmm5t10 years ago

For posterity, the original post from reedom:

To give a chance to blog owners to change Geshi's coloring or other behavior, how about add a hook like:

*** /home/trac/www/wordpress/wp-content/plugins/wp-syntax/wp-syntax.php~        Tue May 29 06:45:16 2007
--- /home/trac/www/wordpress/wp-content/plugins/wp-syntax/wp-syntax.php Fri Jul  6 17:52:13 2007
*** 73,78 ****
--- 73,79 ----

      $geshi = new GeSHi($code, $language);
+     do_action_ref_array('wp-syntax-init-geshi', array(&$geshi));

      $output = "\n<div class=\"wp_syntax\">";

So blog owners can handle the hook in a hand-made plugin or somewhere else like this:

add_action('wp-syntax-init-geshi', 'wpsc_change_styles');

function wpsc_change_styles(&$geshi)
    $geshi->set_brackets_style('color: #000;');
    $geshi->set_keyword_group_style(1, 'color: #22f;');

comment:2 @rmm5t10 years ago

  • Resolution set to fixed
  • Status changed from new to closed

This is now implemented in changeset [17403] and will go out in the v0.6 release

comment:3 @rmm5t10 years ago

One thing to note. I chose to use an action name of "wp_syntax_init_geshi" instead of "wp-syntax-init-geshi" (underscores instead of dashes).

Note: See TracTickets for help on using tickets.