Skip to content

Instantly share code, notes, and snippets.

@jewlofthelotus
Last active August 23, 2016 10:22
Show Gist options
  • Save jewlofthelotus/9022902 to your computer and use it in GitHub Desktop.
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
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