'Left Column',
'id' => 'fruitjuice_left',
'before_widget' => '',
'after_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name'=>'Right Column',
'id' => 'fruitjuice_right',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '
',
));
}
// create icon and text link for attachments
function my_attachment_link($id) {
// grab file extension
$bits = explode('.',get_attached_file($id));
$ext = '.'.$bits[count($bits)-1].' format';
// get the icon link
$icon_link = wp_get_attachment_link($id,'thumbnail',false,true);
// get the text link
$text_link = wp_get_attachment_link($id,'',false,false);
// get the filesize in kilobytes
$filesize = ceil(filesize(get_attached_file($id))/1024).'K';
return $icon_link. ' '.$text_link.' ('.$ext.' '.$filesize.')';
}
// create download link based on attachment mime type
function my_download_link($my_mime_type) {
$download='';
switch (true) {
case (stristr($my_mime_type,'pdf')):
$download = 'Adobe Acrobat Reader';
break;
case (stristr($my_mime_type,'msword')):
$download = 'Microsoft® Word or Word Viewer 2003';
break;
case (stristr($my_mime_type,'excel')):
$download = 'Microsoft® Excel or Excel Viewer 2003';
break;
case (stristr($my_mime_type,'powerpoint')):
$download = 'Microsoft® Powerpoint or Powerpoint Reader';
break;
case (stristr($my_mime_type,'quicktime')):
$download = 'Quicktime';
break;
}
if($download !='') return 'This file requires '.$download;
}
/*
enhanced_link_pages() function taken from ePage Links plugin by Rich Pedley (http://quirm.net/)
Alternative for wp_link_pages to be able to specifiy wrappers for each link. Simply use enhanced_link_pages(array('blink'=>'<li>','alink'=>'</li>','before' => '<ul>', 'after' => '</ul>', 'next_or_number' => 'number'));
in place of wp_link_pages in your themes.
eg. enhanced_link_pages(array('blink'=>'','alink'=>'','before' => '', 'next_or_number' => 'number'));
*/
function enhanced_link_pages($args = '') {
global $post;
if ( is_array($args) )
$r = &$args;
else
parse_str($args, $r);
$defaults = array('before' => '' . __('Pages:'), 'after' => '
', 'next_or_number' => 'number', 'nextpagelink' => __('Next page'),
'previouspagelink' => __('Previous page'), 'pagelink' => '%', 'more_file' => '', 'echo' => 1, 'blink'=>'','alink'=>'');
$r = array_merge($defaults, $r);
extract($r, EXTR_SKIP);
global $id, $page, $numpages, $multipage, $more, $pagenow;
if ( $more_file != '' )
$file = $more_file;
else
$file = $pagenow;
$output = '';
if ( $multipage ) {
if ( 'number' == $next_or_number ) {
$output .= $before;
for ( $i = 1; $i < ($numpages+1); $i = $i + 1 ) {
$j = str_replace('%',"$i",$pagelink);
$output .= ' ';
if ( ($i != $page) || ((!$more) && ($page==1)) ) {
if ( 1 == $i ) {
$output .= $blink.''.$j.''.$alink;
} else {
if ( '' == get_option('permalink_structure') || 'draft' == $post->post_status )
$output .= $blink.''.$j.''.$alink;
else
$output .= $blink.''.$j.''.$alink;
}
}else{
$output .= $blink.''.$j.''.$alink;
}
}
$output .= $after;
} else {
if ( $more ) {
$output .= $before;
$i = $page - 1;
if ( $i && $more ) {
if ( 1 == $i ) {
$output .= $blink.'' . $previouspagelink . ''.$alink;
} else {
if ( '' == get_option('permalink_structure') || 'draft' == $post->post_status )
$output .= $blink.'' . $previouspagelink . ''.$alink;
else
$output .= $blink.'' . $previouspagelink . ''.$alink;
}
}
$i = $page + 1;
if ( $i <= $numpages && $more ) {
if ( 1 == $i ) {
$output .= $blink.'' . $nextpagelink . ''.$alink;
} else {
if ( '' == get_option('permalink_structure') || 'draft' == $post->post_status )
$output .= $blink.'' . $nextpagelink . ''.$alink;
else
$output .= $blink.'' . $nextpagelink . ''.$alink;
}
}
$output .= $after;
}
}
}
if ( $echo )
echo $output;
return $output;
}
/* adds backwardscomments compatibility for pre-WP 2.7 Requires legacy.comments.php in theme */
add_filter( 'comments_template', 'legacy_comments' );
function legacy_comments($file) {
if(!function_exists('wp_list_comments')) $file = TEMPLATEPATH . '/legacy.comments.php';
return $file;
}
/* customised comment template */
function my_theme_comments($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
static $my_comment_count=0;
$my_comment_count++;
?>
id="comment-">
'ASC',
'orderby' => 'menu_order ID',
'id' => $post->ID,
'itemtag' => 'dl',
'icontag' => 'dt',
'captiontag' => 'dd',
'columns' => 3,
'size' => 'thumbnail'
), $attr));
$id = intval($id);
$attachments = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby) );
if ( empty($attachments) ) return '';
if ( is_feed() ) {
$output = "\n";
foreach ( $attachments as $id => $attachment )
$output .= wp_get_attachment_link($id, $size, true) . "\n";
return $output;
}
$itemtag = tag_escape($itemtag);
$captiontag = tag_escape($captiontag);
$columns = intval($columns);
$itemwidth = $columns > 0 ? floor(100/$columns) : 100;
$output = ''."\n";
$i = 0;
foreach ( $attachments as $id => $attachment ) {
$link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
$output .= "\n<".$itemtag.' class="gallery-item" style="width:'.$itemwidth.'%;">'."\n";
$output .= '<'.$icontag.' class="gallery-icon">'.$link.''.$icontag.'>';
if ( $captiontag && trim($attachment->post_excerpt) ) {
$output .= '<'.$captiontag.' class="gallery-caption">'.$attachment->post_excerpt.''.$captiontag.'>';
}
$output .= ''.$itemtag.'>'."\n";
if ( $columns > 0 && ++$i % $columns == 0 )
$output .= "\n".'
'."\n";
}
$output .= "\n".'
'."
\n";
return $output;
}
// Admin - set number of sticky posts to display in left column
add_action('admin_menu', 'theme_admin');
if (!function_exists('theme_admin')) {
// used by the admin panel hook
function theme_admin() {
if (function_exists('add_menu_page')) {
add_theme_page(__('Sticky Fruit Juice','fruitjuice'), __('Sticky Fruit Juice','fruitjuice'),7, basename('fruitjuice_style.php'),'fruitjuice_admin_style');
}
}
}
function fruitjuice_admin_style() {
?>
'.__('Sticky Fruit Juice!','fruitjuice').''."\n";
global $wpdb;
if(isset($_POST['submit'])) {
if($_POST['fruitjuice_sticky']!='0') update_option('fruitjuice_sticky',$wpdb->escape($_POST['fruitjuice_sticky']));
else delete_option('fruitjuice_sticky');
echo'
'.__('The Fruit Juice theme has been updated.','fruitjuice').'
'."\n";
}
?>
This comment is currently in a moderation queue.