'Primary Menu',
'footer-menu' => 'Footer Menu'
)
);
}
}
endif;
add_action( 'after_setup_theme', 'czs_setup' );
/*-----------------------------------------------------------------------------------*/
/* Javascsript
/*-----------------------------------------------------------------------------------*/
function czs_add_scripts() {
$czs_options = get_option('$czs_options');
global $data; //get theme options
wp_enqueue_script('jquery');
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
// Site wide js
wp_enqueue_script('modernizr', get_stylesheet_directory_uri() . '/js/modernizr.min.js');
wp_enqueue_script('customscript', get_stylesheet_directory_uri() . '/js/customscript.js');
wp_enqueue_script('tooltips', get_stylesheet_directory_uri() . '/js/jquery.smallipop.js');
wp_enqueue_script('elastic', get_stylesheet_directory_uri() . '/js/jquery.eislideshow.js');
wp_enqueue_script('elastice', get_stylesheet_directory_uri() . '/js/jquery.easing.1.3.js');
}
add_action('wp_enqueue_scripts','czs_add_scripts');
/*-----------------------------------------------------------------------------------*/
/* Enqueue CSS
/*-----------------------------------------------------------------------------------*/
function czs_enqueue_css() {
global $czs_options;
wp_enqueue_style('stylesheet', get_stylesheet_directory_uri() . '/style.css', 'style');
wp_enqueue_style('tooltipser', get_stylesheet_directory_uri() . '/css/jquery.smallipop.css', 'style');
wp_enqueue_style('icons', get_stylesheet_directory_uri() . '/css/eleganticon_style.css', 'style');
//Responsive
if($czs_options['czs_responsive'] == '1') {
wp_enqueue_style('responsive', get_stylesheet_directory_uri() . '/css/responsive.css', 'style');
}
$czs_sclayout = '';
if($czs_options['czs_layout'] == '1') {
$czs_sclayout = '
.article { float: right; margin-right: 3px; margin-left: 0;}
.sidebar.c-4-12 { float: left; padding-right: 2.4%; }';
}
if(isset($czs_options['czs_custom_css']) != '') {
$czscustom_css = ($czs_options['czs_custom_css']);
} else {
$czscustom_css = '';
}
$custom_css = "
a, #header h1, #logo a, .footer-navigation a {color: #0558ff;}
.footer-navigation a {color: #0558ff !important;}
.read-more :hover { background-color: #00c9e8;}
a:hover {color: #00c9e8;}
a:active {color: #3526a8;}
body {background: #ffffff !important;}
.share-info { color: {$czs_options['czs_body_typography']['color']};}
input#author:focus, input#email:focus, input#url:focus, #commentform textarea:focus { border-color:#0558ff;}
.login-button a, .button, .ei-title h3, .menu .current-menu-item > a:after, .read-more a, .home-cat{ background: #0558ff;}
.current-menu-ancestor > a.sf-with-ul, .current-menu-ancestor, .menu > li:hover > a{ color:#0558ff; }
.menu .current-menu-item > a,.nav-previous a, .nav-next a, .header-button, .sub-menu, #commentform input#submit, .tagcloud a, #tabber ul.tabs li a.selected, .featured-cat, .et-subscribe input[type='submit'], .pagination a { background-color:#0558ff; color: #fff; }
#navigation { background: -webkit-linear-gradient(#2893ff, #284cff); background: -o-linear-gradient(#2893ff, #284cff); background: -moz-linear-gradient(#2893ff, #284cff); background: linear-gradient(#2893ff, #284cff); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#2893ff', endColorstr='#284cff',GradientType=0 ); }
.no-results, #tabber, .copyrights, .postsby, .postauthor, #respond h4, #commentform, .total-comments, .commentmetadata, .post.excerpt, .single_post, .widget, .ss-full-width, #content_box { background-color: #ffffff;}
.main-container {background-color: #e5e5e5;}
.widget, .home-content, .post.excerpt, #navigation, .featured-thumbnail, #navigation ul li { border-color: #a3a3a3;}
.home-cat .meta-desc, .read-more a {color: #ffffff !important}
{$czs_sclayout}
{$czscustom_css}
";
wp_add_inline_style( 'stylesheet', $custom_css );
}
add_action('wp_enqueue_scripts', 'czs_enqueue_css', 99);
/*-----------------------------------------------------------------------------------*/
/* Enable Widgetized sidebar
/*-----------------------------------------------------------------------------------*/
function czs_widgets_init() {
register_sidebar(array(
'name'=>'Sidebar',
'description' => __( 'Appears on posts and pages', 'czsablony' ),
'before_widget' => '
',
'before_title' => '',
'after_title' => '
',
));
$sidebars = array(1, 2, 3);
foreach($sidebars as $number) {
register_sidebar(array(
'name' => 'Footer ' . $number,
'id' => 'footer-' . $number,
'before_widget' => '',
'before_title' => '',
));
}
}
add_action( 'widgets_init', 'czs_widgets_init' );
/*-----------------------------------------------------------------------------------*/
/* Footer widgets
/*-----------------------------------------------------------------------------------*/
function widgetized_footer() {
?>
= 2 || $page >= 2 )
$title = "$title $sep " . sprintf( __( 'Page %s', 'czsablony' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'czs_wp_title', 10, 2 );
/*-----------------------------------------------------------------------------------*/
/* Filters that allow shortcodes in Text Widgets
/*-----------------------------------------------------------------------------------*/
add_filter('widget_text', 'shortcode_unautop');
add_filter('widget_text', 'do_shortcode');
add_filter('the_content_rss', 'do_shortcode');
/*-----------------------------------------------------------------------------------*/
/* Custom Gravatar Support
/*-----------------------------------------------------------------------------------*/
if( !function_exists( 'czs_custom_gravatar' ) ) {
function czs_custom_gravatar( $avatar_defaults ) {
$czs_avatar = get_template_directory_uri() . '/images/gravatar.png';
$avatar_defaults[$czs_avatar] = 'Custom Gravatar (/images/gravatar.png)';
return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'czs_custom_gravatar' );
}
/*-----------------------------------------------------------------------------------*/
/* Custom Comments template
/*-----------------------------------------------------------------------------------*/
function czs_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
switch ( $comment->comment_type ) :
case 'pingback' :
case 'trackback' :
?>
id="comment-">
', '' ); ?>
id="li-comment-">
$chars_limit)
{ $text = $text."..."; } // Ellipsis
return $text;
}
/*-----------------------------------------------------------------------------------*/
/* Homepage Comments template
/*-----------------------------------------------------------------------------------*/
function rw_archive_comment_callback( $comment, $args, $depth )
{
?>
$length ){
$mytitle = substr($mytitle,0,$length);
echo $mytitle . $after;
}
else { echo $mytitle; }
}
/*-----------------------------------------------------------------------------------*/
/* excerpt
/*-----------------------------------------------------------------------------------*/
function czs_excerpt($limit) {
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt);
} else {
$excerpt = implode(" ",$excerpt);
}
$excerpt = preg_replace('`[[^]]*]`','',$excerpt);
return $excerpt;
}
/*-----------------------------------------------------------------------------------*/
/* Post Views
/*-----------------------------------------------------------------------------------*/
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
return __( '0 Views', 'czsablony' );
}
return $count.__( ' Views', 'czsablony' );
}
function setPostViews($postID) {
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
$count = 0;
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
}else{
$count++;
update_post_meta($postID, $count_key, $count);
}
}
// Remove issues with prefetching adding extra views
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
/*-----------------------------------------------------------------------------------*/
/* nofollow to next/previous links
/*-----------------------------------------------------------------------------------*/
function czs_pagination_add_nofollow($content) {
return 'rel="nofollow"';
}
add_filter('next_posts_link_attributes', 'czs_pagination_add_nofollow' );
add_filter('previous_posts_link_attributes', 'czs_pagination_add_nofollow' );
/*-----------------------------------------------------------------------------------*/
/* Nofollow to category links
/*-----------------------------------------------------------------------------------*/
add_filter( 'the_category', 'czs_add_nofollow_cat' );
function czs_add_nofollow_cat( $text ) {
$text = str_replace('rel="category tag"', 'rel="nofollow"', $text); return $text; }
/*-----------------------------------------------------------------------------------*/
/* nofollow to reply links
/*-----------------------------------------------------------------------------------*/
function czs_add_nofollow_to_reply_link( $link ) {
return str_replace( '")\'>', '")\' rel=\'nofollow\'>', $link );
}
add_filter( 'comment_reply_link', 'czs_add_nofollow_to_reply_link' );
/*-----------------------------------------------------------------------------------*/
/* adds a class to the post if there is a thumbnail
/*-----------------------------------------------------------------------------------*/
function has_thumb_class($classes) {
global $post;
if( has_post_thumbnail($post->ID) ) { $classes[] = 'has_thumb'; }
return $classes;
}
add_filter('post_class', 'has_thumb_class');
/*-----------------------------------------------------------------------------------*/
/* Pagination
/*-----------------------------------------------------------------------------------*/
function czs_pagination($pages = '', $range = 3) {
$showitems = ($range * 3)+1;
$first = __('« First', 'czsablony');
$previous = __('‹ Previous', 'czsablony');
$next = __('Next ›', 'czsablony');
$last = __('Last »', 'czsablony');
global $paged; if(empty($paged)) $paged = 1;
if($pages == '') {
global $wp_query; $pages = $wp_query->max_num_pages;
if(!$pages){ $pages = 1; }
}
if(1 != $pages) {
echo "";
}
}
/*-----------------------------------------------------------------------------------*/
/* Single Post Pagination
/*-----------------------------------------------------------------------------------*/
function czs_wp_link_pages_args_prevnext_add($args)
{
global $page, $numpages, $more, $pagenow;
if (!$args['next_or_number'] == 'next_and_number')
return $args;
$args['next_or_number'] = 'number';
if (!$more)
return $args;
if($page-1)
$args['before'] .= _wp_link_page($page-1)
. $args['link_before']. $args['previouspagelink'] . $args['link_after'] . ''
;
if ($page<$numpages)
$args['after'] = _wp_link_page($page+1)
. $args['link_before'] . $args['nextpagelink'] . $args['link_after'] . ''
. $args['after']
;
return $args;
}
add_filter('wp_link_pages_args', 'czs_wp_link_pages_args_prevnext_add');
/*-----------------------------------------------------------------------------------*/
/* add button to tinymce
/*-----------------------------------------------------------------------------------*/
add_filter('mce_buttons','czs_wysiwyg_editor');
function czs_wysiwyg_editor($mce_buttons) {
$pos = array_search('wp_more',$mce_buttons,true);
if ($pos !== false) {
$tmp_buttons = array_slice($mce_buttons, 0, $pos+1);
$tmp_buttons[] = 'wp_page';
$mce_buttons = array_merge($tmp_buttons, array_slice($mce_buttons, $pos+1));
}
return $mce_buttons;
}
?>