Last active
August 23, 2016 10:22
-
-
Save jewlofthelotus/9022902 to your computer and use it in GitHub Desktop.
An example WordPress plugin that hooks into the SlickQuiz WordPress plugin. Thanks to @phh for his contribution and example from which this is modified. https://github.com/jewlofthelotus/SlickQuiz-WordPress/pull/37
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomSlickQuizFilters { | |
function __construct() | |
{ | |
add_filter( 'slickquiz_admin_options', array( &$this, 'custom_admin_options' ) ); | |
add_filter( 'slickquiz_after_options', array( &$this, 'custom_after_options' ) ); | |
add_filter( 'slickquiz_after_result', array( &$this, 'custom_after_result' ) ); | |
} | |
function custom_admin_options( $options ) | |
{ | |
$options['read_more_links'] = ''; | |
return $options; | |
} | |
function custom_after_options( $obj ) | |
{ ?> | |
<h3 class="title">Result Options</h3> | |
<table class="form-table"> | |
<tbody> | |
<tr valign="top"> | |
<th scope="row"> | |
<label for="slickQuizOptions[read_more_links]">Read more links:</label> | |
</th> | |
<td> | |
<textarea name="slickQuizOptions[read_more_links]"><?php _e( apply_filters( 'format_to_edit', $obj->get_admin_option( 'read_more_links' ) ) ); ?></textarea> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
<?php | |
} | |
function custom_after_result( $obj ) | |
{ | |
$out = '<div class="read_more_links">'; | |
$out .= $obj->get_admin_option( 'read_more_links' ); | |
$out .= '</div>'; | |
return $out; | |
} | |
} | |
$custom_sq_filters = new CustomSlickQuizFilters; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment