ID, 'description', true) !='') $my_output .= get_post_meta($post->ID, 'description', true); else { while(have_posts()):the_post(); $my_excerpt = str_replace(array("\r\n", "\r", "\n"), ' ', get_the_excerpt()); $my_output .= strip_tags(apply_filters('the_excerpt', $my_excerpt)); endwhile; } break; default: $my_output .= esc_html( get_bloginfo('name') . __(': ') . get_bloginfo('description') ); } return $my_output; } // Create meta-keywords function theme_meta_keywords() { $my_output = ''; global $post; switch(true) { case (is_category()): $my_output .= strtolower(single_cat_title('', false)); break; case (is_tag()): $my_output .= strtolower(single_tag_title('', false)); break; case (is_archive()): $my_output .= __('archives ', 'blackcurrent') ; if(is_year()) $my_output .= get_the_time('Y'); if(is_month()) $my_output .= strtolower(get_the_time('F Y')); if(is_day()) $my_output .= strtolower(get_the_time('l F Y')); break; case (is_page()): $my_output .= strtolower(trim(wp_title('',false,''))); if(get_post_meta($post->ID, 'keywords', true) !='') $my_output .= ' '.get_post_meta($post->ID, 'keywords', true); break; case (is_single()): $my_output .= strtolower(trim(wp_title('',false,''))); if(get_post_meta($post->ID, 'keywords', true) !='') $my_output .= ' '.get_post_meta($post->ID, 'keywords', true); foreach((get_the_category()) as $category) { $my_output .= ' ' . strtolower($category->cat_name); } break; default: $my_output .= esc_html( strtolower( get_bloginfo('name').' '.get_bloginfo('description') ) ); } return $my_output; } // Create decent attachment links function theme_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 if(@filesize(get_attached_file($id))) { $filesize = ceil(filesize(get_attached_file($id))/1024).'K'; return $icon_link. ' '.$text_link.' ('.$ext.' '.$filesize.')'; } else return $icon_link. ' '.$text_link.' ('.$ext.')'; } // Create decent attachment download links function theme_attachment_download_link($msg, $my_mime_type, $or) { // create download link based on attachment mime type $download=''; $viewer_links = 'http://office.microsoft.com/en-gb/downloads/ha010449811033.aspx'; 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'; 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 $msg . $download; } /* theme_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 theme_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. theme_link_pages(array('blink'=>'
  • ','alink'=>'
  • ','before' => '', 'next_or_number' => 'number')); */ function theme_link_pages($args = '') { global $post; if (is_array($args) ) $r = &$args; else parse_str($args, $r); $defaults = array('before' => '

    ' . __('Pages:','blackcurrent'), 'after' => '

    ', 'next_or_number' => 'number', 'nextpagelink' => __('Next page','blackcurrent'), 'previouspagelink' => __('Previous page','blackcurrent'), '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; } // remove gallery css add_filter('gallery_style', create_function('$a', 'return "
    ";')); // List child pages function theme_subpages($this_page) { if (is_page()) { if ($post->post_parent) $this_page= $post->post_parent; $children = get_page_children($this_page, get_pages()); if($children) { $subpages = '

    ' . __('Pages in this section', 'blackcurrent') . '

    \n"; } } return $subpages; } // Get archive date function theme_get_archive_date() { if (is_day()) $this_archive = get_the_time('j F Y'); elseif (is_month()) $this_archive = get_the_time('F Y'); else $this_archive = get_the_time('Y'); return $this_archive; } // Strip slashes // only use after magic quote check // if (get_magic_quotes_gpc()) {} function theme_stripslashes_array($array) { if (get_magic_quotes_gpc()) { foreach($array as $key=>$value) { $array[$key] = stripslashes($value); } } return $array; } // Sanitise an input array function theme_sanitise_array($array) { return is_array($array) ? array_map('theme_sanitise_array', $array) : esc_html($array,ENT_QUOTES); } // test to see if a string is empty or set to zero function is_populated($string) { if($string != '' && $string != 0) return true; else return false; } ?>