scroll-to-top checkbox in the general options and associated file changes

Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
Philip M. Hofer (Frumph) 2009-12-26 06:44:29 -08:00
parent 800a840be7
commit 0aac1cc944
4 changed files with 22 additions and 6 deletions

View File

@ -57,7 +57,8 @@ function comicpress_admin() {
'disable_footer_text',
'disable_blogheader',
'enable_comicpress_debug',
'enable_full_post_check'
'enable_full_post_check',
'enable_scroll_to_top'
) as $key) {
$comicpress_options[$key] = (bool)( $_REQUEST[$key] == 1 ? true : false );
}

View File

@ -27,13 +27,15 @@
<span class="footer-pipe">|</span>
Subscribe: <a href="<?php bloginfo('rss2_url') ?>">RSS</a>
</span>
<?php if ($comicpress_options['enable_scroll_to_top']) { ?>
<span class="footer-uptotop">
<span class="footer-pipe">|</span>
<a href="#outside" onclick="scrollup(); return false;"><?php _e('Back to Top &uarr;','comicpress'); ?></a>
</span>
<br /><?php echo get_num_queries() ?> queries. <?php timer_stop(1) ?> seconds.
<?php } ?>
</p>
<?php } ?>
<p><?php echo get_num_queries() ?> queries. <?php timer_stop(1) ?> seconds.</p>
</div>
<?php if (!$comicpress_options['disable_page_restraints']) { ?>

View File

@ -42,6 +42,7 @@ function __comicpress_widgets_init() {
function __comicpress_init() {
global $comicpress_options, $__comicpress_handlable_classes;
$comicpress_options = array();
// Check if the $comicpress_options exist, if not set defaults
$comicpress_options = comicpress_load_options();
@ -54,7 +55,9 @@ function __comicpress_init() {
}
// Queue up the scripts.
if (!is_admin() && $comicpress_options['enable_scroll_to_top']) {
wp_enqueue_script('comicpress_scroll', get_template_directory_uri() . '/js/scroll.js');
}
// remove intense debates control over the comment numbers
if (function_exists('id_get_comment_number')) {
@ -199,7 +202,8 @@ function comicpress_load_options() {
'enable_blogroll_off_links' => false,
'enable_comment_count_in_rss' => false
'enable_comment_count_in_rss' => false,
'enable_scroll_to_top' => false
) as $field => $value) {
$comicpress_options[$field] = $value;

View File

@ -47,7 +47,7 @@
<?php _e('Checkmark this and your site will not display the contents of #blogheader.','comicpress'); ?>
</td>
</tr>
<tr>
<tr class="alternate">
<th scope="row"><label for="enable_comment_count_in_rss"><?php _e('Enable the comment count to show in feed title.','comicpress'); ?></label></th>
<td>
<input id="enable_comment_count_in_rss" name="enable_comment_count_in_rss" type="checkbox" value="1" <?php checked(true, $comicpress_options['enable_comment_count_in_rss']); ?> />
@ -160,6 +160,15 @@
<?php _e('Default text in the footer will not display. Enable this if you do not want any text in the footer. If you wish to add you own custom content, you may do so via Appearance -> Widgets-> Footer.', 'comicpress'); ?>
</td>
</tr>
<tr>
<th scope="row"><label for="enable_scroll_to_top"><?php _e('Enable the scroll to top link in the footer?','comicpress'); ?></label></th>
<td>
<input id="enable_scroll_to_top" name="enable_scroll_to_top" type="checkbox" value="1" <?php checked(true, $comicpress_options['enable_scroll_to_top']); ?> />
</td>
<td>
<?php _e('When this link is clicked on long pages it will scroll back to the top.','comicpress'); ?>
</td>
</tr>
</table>
<table class="widefat">