removed more of dropbar, finished the comicpress archive dropdown 2.8 widget

Signed-off-by: Philip M. Hofer (Frumph) <frumph_dragon@yahoo.com>
This commit is contained in:
Philip M. Hofer (Frumph) 2009-08-27 12:48:09 -07:00
parent 6bb85f9287
commit f87ad80919
7 changed files with 94 additions and 118 deletions

View File

@ -120,6 +120,7 @@ require_once(get_template_directory() . '/widgets/comicdate.php');
require_once(get_template_directory() . '/widgets/comictitle.php'); require_once(get_template_directory() . '/widgets/comictitle.php');
require_once(get_template_directory() . '/widgets/comiccomments.php'); require_once(get_template_directory() . '/widgets/comiccomments.php');
require_once(get_template_directory() . '/widgets/menubar.php'); require_once(get_template_directory() . '/widgets/menubar.php');
require_once(get_template_directory() . '/widgets/archive-dropdown.php');
// FUNCTIONS & Extra's // FUNCTIONS & Extra's
@ -361,28 +362,28 @@ function get_next_storyline_start_permalink() {
function get_adjacent_storyline_category_id($next = false) { function get_adjacent_storyline_category_id($next = false) {
global $post, $category_tree; global $post, $category_tree;
$categories = wp_get_post_categories($post->ID); $categories = wp_get_post_categories($post->ID);
if (is_array($categories)) { if (is_array($categories)) {
$category_id = reset($categories); $category_id = reset($categories);
for ($i = 0, $il = count($category_tree); $i < $il; ++$i) { for ($i = 0, $il = count($category_tree); $i < $il; ++$i) {
$storyline_category_id = end(explode("/", $category_tree[$i])); $storyline_category_id = end(explode("/", $category_tree[$i]));
if ($storyline_category_id == $category_id) { if ($storyline_category_id == $category_id) {
$target_index = false; $target_index = false;
if ($next) { if ($next) {
$target_index = $i + 1; $target_index = $i + 1;
} else { } else {
$target_index = $i - 1; $target_index = $i - 1;
} }
if (isset($category_tree[$target_index])) { if (isset($category_tree[$target_index])) {
return end(explode('/', $category_tree[$target_index])); return end(explode('/', $category_tree[$target_index]));
} }
} }
} }
} }
return false; return false;
} }
/** /**
@ -715,20 +716,7 @@ if ( function_exists('register_sidebar') ) {
register_sidebar(array('name'=>'Under Blog','before_widget' => '<ul><li id="%1$s" class="widget %2$s">','after_widget' => '</li></ul>','before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>' )); register_sidebar(array('name'=>'Under Blog','before_widget' => '<ul><li id="%1$s" class="widget %2$s">','after_widget' => '</li></ul>','before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>' ));
register_sidebar(array('name'=>'Footer','before_widget' => '<ul><li id="%1$s" class="widget %2$s">','after_widget' => '</li></ul>','before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>' )); register_sidebar(array('name'=>'Footer','before_widget' => '<ul><li id="%1$s" class="widget %2$s">','after_widget' => '</li></ul>','before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>' ));
register_sidebar(array('name'=>'Drop Bar','before_widget' => '<ul><li id="%1$s" class="widget %2$s">','after_widget' => '</li></ul>','before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>' )); register_sidebar(array('name'=>'Drop Bar','before_widget' => '<ul><li id="%1$s" class="widget %2$s">','after_widget' => '</li></ul>','before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>' ));
} }
function widget_comicpress_archive_dropdown() { ?>
<ul>
<li class="archive-dropdown-wrap">
<select name="archive-dropdown" class="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>
<option value=""><?php echo attribute_escape(__('Archives...')); ?></option>
<?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?> </select>
</li>
</ul>
<?php } if ( function_exists('register_sidebar_widget') )
register_sidebar_widget(__('Archive Dropdown'), 'widget_comicpress_archive_dropdown');
function storyline_category_list() { function storyline_category_list() {
$listcats = wp_list_categories('echo=0&title_li=&include='.get_all_comic_categories_as_cat_string()); $listcats = wp_list_categories('echo=0&title_li=&include='.get_all_comic_categories_as_cat_string());

View File

@ -2,7 +2,7 @@
// Custom Image Header // Custom Image Header
define('HEADER_TEXTCOLOR', '000'); define('HEADER_TEXTCOLOR', '000');
// define('HEADER_IMAGE', '%s/images/header-blank.png'); // %s is theme dir uri define('HEADER_IMAGE', '%s/images/header-blank.png'); // %s is theme dir
define('HEADER_IMAGE_WIDTH', $custom_image_header_width); define('HEADER_IMAGE_WIDTH', $custom_image_header_width);
define('HEADER_IMAGE_HEIGHT', $custom_image_header_height); define('HEADER_IMAGE_HEIGHT', $custom_image_header_height);

View File

@ -1,68 +0,0 @@
var DropBarMover = new Object();
DropBarMover.isMouseOver = false;
DropBarMover.isFocus = false;
DropBarMover.timerID = null;
DropBarMover.DropBarInstance = null;
DropBarMover.mouseOver = function (e)
{
this.isMouseOver = true;
this.adjustDropBar();
}
DropBarMover.mouseOut = function (e)
{
this.isMouseOver = false;
this.adjustDropBar();
}
DropBarMover.focus = function (e)
{
this.isFocus = true;
this.adjustDropBar();
}
DropBarMover.blur = function (e)
{
this.isFocus = false;
this.adjustDropBar();
}
DropBarMover.adjustDropBar = function()
{
if ( this.timerID == null )
{
if ( !this.DropBarInstance )
this.DropBarInstance = document.getElementById('DropBar');
this.timerID = window.setInterval(function(){
var Location = DropBarMover.DropBarInstance.style.top;
Location = parseInt(Location.substr(0,Location.length-2));
if ( DropBarMover.isMouseOver || DropBarMover.isFocus )
{
if ( Location < 0 )
{
Location+=5;
DropBarMover.DropBarInstance.style.top = Location + 'px';
}
else
{
window.clearInterval(DropBarMover.timerID);
DropBarMover.timerID = null;
}
}
else
{
if ( Location > -100 )
{
Location-=5;
DropBarMover.DropBarInstance.style.top = Location + 'px';
}
else
{
window.clearInterval(DropBarMover.timerID);
DropBarMover.timerID = null;
}
}
}, 20);
}
}

View File

@ -7,6 +7,7 @@
<?php comicpress_calendar() ?> <?php comicpress_calendar() ?>
</li> </li>
</ul> </ul>
<?php comicpress_archive_dropdown(); ?>
<?php comicpress_latest_comics() ?> <?php comicpress_latest_comics() ?>
<ul> <ul>
<li> <li>

View File

@ -0,0 +1,65 @@
<?php
/*
Widget Name:
Widget URI: http://comicpress.org/
Description:
Author: Philip M. Hofer (Frumph)
Version: 1.01
Author URI: http://webcomicplanet.com/
*/
function comicpress_archive_dropdown() { ?>
<ul>
<li class="archive-dropdown-wrap">
<select name="archive-dropdown" class="archive-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'>
<option value=""><?php echo attribute_escape(__('Archives...')); ?></option>
<?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?> </select>
</li>
</ul>
<?php }
class widget_comicpress_archive_dropdown extends WP_Widget {
function widget_comicpress_archive_dropdown() {
$widget_ops = array('classname' => 'widget_comicpress_archive_dropdown', 'description' => 'Display a thumbnail of the latest comic, clickable to go to the comic post.' );
$this->WP_Widget('archive_dropdown', 'ComicPress Archive Dropdown', $widget_ops);
}
function widget($args, $instance) {
global $post;
extract($args, EXTR_SKIP);
echo $before_widget;
$title = empty($instance['title']) ? '' : apply_filters('widget_title', $instance['title']);
if ( !empty( $title ) ) { echo $before_title . $title . $after_title; };
comicpress_archive_dropdown();
echo $after_widget;
}
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
$title = strip_tags($instance['title']);
?>
<p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<?php
}
}
register_widget('widget_comicpress_archive_dropdown');
function widget_comicpress_archive_dropdown_init() {
new widget_comicpress_archive_dropdown();
}
add_action('widgets_init', 'widget_comicpress_archive_dropdown_init');
?>

View File

@ -1,14 +0,0 @@
<?php
/*
Widget Name:
Widget URI: http://comicpress.org/
Description:
Author: Philip M. Hofer (Frumph)
Version: 1.01
Author URI: http://webcomicplanet.com/
*/
?>

View File

@ -20,7 +20,11 @@ function comicpress_calendar($instance) {
<div id="wp-calendar-wrap"> <div id="wp-calendar-wrap">
<?php if (!empty($thumbnail)) { ?> <?php if (!empty($thumbnail)) { ?>
<img src="<?php echo $thumbnail; ?>" alt="" class="wp-calendar-thumb" /><br /> <img src="<?php echo $thumbnail; ?>" alt="" class="wp-calendar-thumb" /><br />
<?php if (!empty($small)) { ?>[<a href="<?php echo $small; ?>">S</a>] <?php } ?><?php if (!empty($medium)) { ?>[<a href="<?php echo $medium; ?>">M</a>] <?php } ?><?php if (!empty($large)) { ?>[<a href="<?php echo $large; ?>">L</a>] <?php } ?> <?php if (!empty($small) || !empty($medium) || !empty($large)) { ?>
<div class="wp-calendar-download">
<?php if (!empty($small)) { ?>[<a href="<?php echo $small; ?>" title="Download">S</a>] <?php } ?><?php if (!empty($medium)) { ?>[<a href="<?php echo $medium; ?>" title="Download">M</a>] <?php } ?><?php if (!empty($large)) { ?>[<a href="<?php echo $large; ?>" title="Download">L</a>] <?php } ?>
</div>
<?php } ?>
<?php } ?> <?php } ?>
<?php get_calendar(); ?> <?php get_calendar(); ?>
</div> </div>
@ -65,7 +69,7 @@ class widget_comicpress_calendar extends WP_Widget {
?> ?>
<p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p> <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo attribute_escape($title); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('thumbnail'); ?>">Thumbnail URL: <input class="widefat" id="<?php echo $this->get_field_id('thumbnail'); ?>" name="<?php echo $this->get_field_name('thumbnail'); ?>" type="text" value="<?php echo attribute_escape($thumbnail); ?>" /></label></p> <p><label for="<?php echo $this->get_field_id('thumbnail'); ?>">Thumbnail URL (178px by 130px): <input class="widefat" id="<?php echo $this->get_field_id('thumbnail'); ?>" name="<?php echo $this->get_field_name('thumbnail'); ?>" type="text" value="<?php echo attribute_escape($thumbnail); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('small'); ?>">Wallpaper URL (Small): <input class="widefat" id="<?php echo $this->get_field_id('small'); ?>" name="<?php echo $this->get_field_name('small'); ?>" type="text" value="<?php echo attribute_escape($small); ?>" /></label></p> <p><label for="<?php echo $this->get_field_id('small'); ?>">Wallpaper URL (Small): <input class="widefat" id="<?php echo $this->get_field_id('small'); ?>" name="<?php echo $this->get_field_name('small'); ?>" type="text" value="<?php echo attribute_escape($small); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('medium'); ?>">Wallpaper URL (Medium): <input class="widefat" id="<?php echo $this->get_field_id('medium'); ?>" name="<?php echo $this->get_field_name('medium'); ?>" type="text" value="<?php echo attribute_escape($medium); ?>" /></label></p> <p><label for="<?php echo $this->get_field_id('medium'); ?>">Wallpaper URL (Medium): <input class="widefat" id="<?php echo $this->get_field_id('medium'); ?>" name="<?php echo $this->get_field_name('medium'); ?>" type="text" value="<?php echo attribute_escape($medium); ?>" /></label></p>
<p><label for="<?php echo $this->get_field_id('large'); ?>">Wallpaper URL (Large): <input class="widefat" id="<?php echo $this->get_field_id('large'); ?>" name="<?php echo $this->get_field_name('large'); ?>" type="text" value="<?php echo attribute_escape($large); ?>" /></label></p> <p><label for="<?php echo $this->get_field_id('large'); ?>">Wallpaper URL (Large): <input class="widefat" id="<?php echo $this->get_field_id('large'); ?>" name="<?php echo $this->get_field_name('large'); ?>" type="text" value="<?php echo attribute_escape($large); ?>" /></label></p>