Plugin Directory

Changeset 490744


Ignore:
Timestamp:
01/16/2012 07:37:59 PM (14 years ago)
Author:
lassebunk
Message:

add more shortcode content

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abtest/trunk/abtest.php

    r490686 r490744  
    1818// Ensure that widgets can also contain A/B Test shortcodes
    1919add_filter('widget_text', 'do_shortcode');
     20add_filter('widget_title', 'do_shortcode');
     21add_filter('the_title', 'do_shortcode');
     22
     23// Use the jQuery framework
    2024wp_enqueue_script("jquery");
    2125
     
    168172}
    169173
     174add_action('wp_head', 'abtest_ob_start');
     175function abtest_ob_start() {
     176  if (get_option('abtest_do_shortcode_on_output_buffer')) {
     177    ob_start('abtest_ob_callback');
     178  }
     179}
     180
     181add_action('wp_footer', 'abtest_ob_end');
     182function abtest_ob_end() {
     183  if (get_option('abtest_do_shortcode_on_output_buffer')) {
     184    ob_end();
     185  }
     186}
     187
     188function abtest_ob_callback($content) {
     189  return do_shortcode($content);
     190}
     191
    170192// [abtest experiment="123"]
    171193add_shortcode( 'abtest', 'abtest_handle_shortcode' );
Note: See TracChangeset for help on using the changeset viewer.