isTablet()){
$return .= '.cssmenu ul ul ul, .cssmenu > ul > li > ul {display: none;} ';
}
if($return) {
echo '';
}
}
add_action( 'wp_enqueue_scripts', 'browser_styles' );
// adding the conditional wrapper around ie stylesheet
// source: http://code.garyjones.co.uk/ie-conditional-style-sheets-wordpress/
function DS_ie_conditional( $tag, $handle ) {
if ( 'DS-ie-only' == $handle )
$tag = '' . "\n";
return $tag;
}
/*********************
THEME SUPPORT
*********************/
// Adding WP 3+ Functions & Theme Support
function DS_theme_support() {
// wp thumbnails (sizes handled in functions.php)
add_theme_support('post-thumbnails');
// default thumb size
set_post_thumbnail_size(1000, 400, true);
// wp custom background (thx to @bransonwerner for update)
add_theme_support( 'custom-background',
array(
'default-image' => '', // background image default
'default-color' => '', // background color default (dont add the #)
'wp-head-callback' => '_custom_background_cb',
'admin-head-callback' => '',
'admin-preview-callback' => ''
)
);
// rss thingy
add_theme_support('automatic-feed-links');
// registering wp3+ menus
register_nav_menus(
array(
'main-nav' => __( 'The Main Menu', THEME ), // main nav in header
)
);
} /* end DS theme support */
/*********************
MENUS & NAVIGATION
*********************/
function ds_main_nav_fallback() {
wp_page_menu( array(
'show_home' => true,
'menu_class' => 'cssmenu' // adding custom nav class
));
}
/*********************
RELATED POSTS FUNCTION
*********************/
function DS_related_posts() {
echo '
';
global $post;
$tags = wp_get_post_tags($post->ID);
if($tags) {
foreach($tags as $tag) { $tag_arr .= $tag->slug . ','; }
$args = array(
'tag' => $tag_arr,
'numberposts' => 5, /* you can change this to show more */
'post__not_in' => array($post->ID)
);
$related_posts = get_posts($args);
if($related_posts) {
foreach ($related_posts as $post) : setup_postdata($post); ?>
No Related Posts Yet!'; ?>
';
}
/*********************
PAGE NAVI
*********************/
function DS_page_navi($before = '', $after = '') {
global $wpdb, $wp_query;
$request = $wp_query->request;
$posts_per_page = intval(get_query_var('posts_per_page'));
$paged = intval(get_query_var('paged'));
$numposts = $wp_query->found_posts;
$max_page = $wp_query->max_num_pages;
if ( $numposts <= $posts_per_page ) {
return;
}
if(empty($paged) || $paged == 0) {
$paged = 1;
}
$pages_to_show = 7;
$pages_to_show_minus_1 = $pages_to_show-1;
$half_page_start = floor($pages_to_show_minus_1/2);
$half_page_end = ceil($pages_to_show_minus_1/2);
$start_page = $paged - $half_page_start;
if($start_page <= 0) {
$start_page = 1;
}
$end_page = $paged + $half_page_end;
if(($end_page - $start_page) != $pages_to_show_minus_1) {
$end_page = $start_page + $pages_to_show_minus_1;
}
if($end_page > $max_page) {
$start_page = $max_page - $pages_to_show_minus_1;
$end_page = $max_page;
}
if($start_page <= 0) {
$start_page = 1;
}
echo $before.''.$after."";
}
/*********************
RANDOM CLEANUP ITEMS
*********************/
// This adds a button to the Read More link
function DS_excerpt_more($more) {
global $post;
// edit here if you like
return '...'; // Read More'; //»
}
/*
* This is a modified the_author_posts_link() which just returns the link.
*
* This is necessary to allow usage of the usual l10n process with printf().
*/
function ds_get_the_author_posts_link() {
global $authordata;
if ( !is_object( $authordata ) )
return false;
$link = sprintf(
'%3$s',
get_author_posts_url( $authordata->ID, $authordata->user_nicename ),
esc_attr( sprintf( __( 'Posts by %s', THEME ), get_the_author() ) ), // No further l10n needed, core will take care of this one
get_the_author()
);
return $link;
}
if ( ! function_exists( 'ds_posted_on' ) ) :
/**
* Print HTML with meta information for the current post-date/time and author.
*/
function ds_posted_on() {
// Set up and print post meta information.
printf( 'Posted %2$s ago',get_permalink(),
human_time_diff( get_the_time('U'), current_time('timestamp') ));
}
endif;
/**
* Apply theme's stylesheet to the visual editor.
*
* @uses add_editor_style() Links a stylesheet to visual editor
* @uses get_stylesheet_uri() Returns URI of theme stylesheet
*/
function ds_add_editor_styles() {
add_editor_style( THEME_URI . '/css/style.css' );
}
// Search form with font awesome maginifying glass icon
function DS_wpsearch($form) {
$form = '