'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('flexslider', get_stylesheet_directory_uri() . '/js/jquery.flexslider.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('icons', get_stylesheet_directory_uri() . '/css/eleganticon_style.css', 'style');
wp_enqueue_style('stylesheetflex', get_stylesheet_directory_uri() . '/css/flexslider.css', 'style');
//Responsive
if($czs_options['czs_responsive'] == '1') {
wp_enqueue_style('responsive', get_stylesheet_directory_uri() . '/css/responsive.css', 'style');
}
$custom_css = "
a {color: #f73838;}
.read-more :hover { background-color: #c41300;}
a:hover {color: #c41300;}
a:active {color: #ffb73a;}
input#author:focus, input#email:focus, input#url:focus, #commentform textarea:focus { border-color:#f73838;}
.top-board, .login-button a, .button, .ei-title h3, .menu .current-menu-item > a:after, .read-more a, .home-cat, #top-content{ background: #f73838;}
.current-menu-ancestor > a.sf-with-ul, .current-menu-ancestor, .menu > li:hover > a{ color:#f73838; }
.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, .carousel-title { background-color:#f73838; color: #fff; }
.secondary-navigation { background: #ffffff; }
.no-results, #tabber, .copyrights, .postsby, .postauthor, #respond h3, #commentform, .total-comments, .commentmetadata, .post.excerpt, .flex-caption, .single_post, .ss-full-width, #content_box { background-color: #474747;}
.header-logo { background: #f73838; filter: brightness(0.97); -webkit-filter: brightness(0.97); -moz-filter: brightness(0.97); -o-filter: brightness(0.97); -ms-filter: brightness(0.97);}
.widget, #login .inside {background-color: #474747;}
";
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', 'czs' ),
'before_widget' => '
',
'before_title' => '',
'after_title' => '
',
));
$sidebars = array(1, 2, 3, 4);
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() {
?>
comment_type ) :
case 'pingback' :
case 'trackback' :
?>
id="comment-">
', '' ); ?>
id="li-comment-">
$chars_limit)
{ $text = $text."..."; } // Ellipsis
return $text;
}
/*-----------------------------------------------------------------------------------*/
/* Most commented posts
/*-----------------------------------------------------------------------------------*/
function czs_most_commented($comment_posts = 5 , $avatar_size = 60){
$comments = get_comments('status=approve&number='.$comment_posts);
foreach ($comments as $comment) { ?>
$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;
}
/*-----------------------------------------------------------------------------------*/
/* 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 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' );
/*-----------------------------------------------------------------------------------*/
/* 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');
/*-----------------------------------------------------------------------------------*/
/* Breadcrumbs
/*-----------------------------------------------------------------------------------*/
function czs_breadcrumbs(){
/* === OPTIONS === */
$text['home'] = __('Home','czs'); // text for the 'Home' link
$text['category'] = __('Archive by Category "%s"','czs'); // text for a category page
$text['tax'] = __('Archive for "%s"','czs'); // text for a taxonomy page
$text['search'] = __('Search Results for "%s" Query','czs'); // text for a search results page
$text['tag'] = __('Posts Tagged "%s"','czs'); // text for a tag page
$text['author'] = __('Articles Posted by %s','czs'); // text for an author page
$text['404'] = __('Error 404','czs'); // text for the 404 page
$showCurrent = 1; // 1 - show current post/page title in breadcrumbs, 0 - don't show
$showOnHome = 0; // 1 - show breadcrumbs on the homepage, 0 - don't show
$delimiter = ' » '; // delimiter between crumbs
$before = ''; // tag before the current crumb
$after = ''; // tag after the current crumb
/* === END OF OPTIONS === */
global $post;
$homeLink = esc_url( home_url() ) . '/';
$linkBefore = '';
$linkAfter = '';
$linkAttr = ' rel="v:url" property="v:title"';
$link = $linkBefore . '%2$s' . $linkAfter;
if (is_home() || is_front_page()) {
if ($showOnHome == 1) echo '';
} else {
echo '' . sprintf($link, $homeLink, $text['home']) . $delimiter;
if ( is_category() ) {
$thisCat = get_category(get_query_var('cat'), false);
if ($thisCat->parent != 0) {
$cats = get_category_parents($thisCat->parent, TRUE, $delimiter);
$cats = str_replace('
', '' . $linkAfter, $cats);
echo $cats;
}
echo $before . sprintf($text['category'], single_cat_title('', false)) . $after;
} elseif( is_tax() ){
$thisCat = get_category(get_query_var('cat'), false);
if ($thisCat->parent != 0) {
$cats = get_category_parents($thisCat->parent, TRUE, $delimiter);
$cats = str_replace('
', '' . $linkAfter, $cats);
echo $cats;
}
echo $before . sprintf($text['tax'], single_cat_title('', false)) . $after;
}elseif ( is_search() ) {
echo $before . sprintf($text['search'], get_search_query()) . $after;
} elseif ( is_day() ) {
echo sprintf($link, get_year_link(get_the_time('Y')), get_the_time('Y')) . $delimiter;
echo sprintf($link, get_month_link(get_the_time('Y'),get_the_time('m')), get_the_time('F')) . $delimiter;
echo $before . get_the_time('d') . $after;
} elseif ( is_month() ) {
echo sprintf($link, get_year_link(get_the_time('Y')), get_the_time('Y')) . $delimiter;
echo $before . get_the_time('F') . $after;
} elseif ( is_year() ) {
echo $before . get_the_time('Y') . $after;
} elseif ( is_single() && !is_attachment() ) {
if ( get_post_type() != 'post' ) {
$post_type = get_post_type_object(get_post_type());
$slug = $post_type->rewrite;
printf($link, $homeLink . '/' . $slug['slug'] . '/', $post_type->labels->singular_name);
if ($showCurrent == 1) echo $delimiter . $before . get_the_title() . $after;
} else {
$cat = get_the_category(); $cat = $cat[0];
$cats = get_category_parents($cat, TRUE, $delimiter);
if ($showCurrent == 0) $cats = preg_replace("#^(.+)$delimiter$#", "$1", $cats);
$cats = str_replace('
', '' . $linkAfter, $cats);
echo $cats;
if ($showCurrent == 1) echo $before . get_the_title() . $after;
}
} elseif ( !is_single() && !is_page() && get_post_type() != 'post' && !is_404() ) {
$post_type = get_post_type_object(get_post_type());
echo $before . $post_type->labels->singular_name . $after;
} elseif ( is_attachment() ) {
$parent = get_post($post->post_parent);
$cat = get_the_category($parent->ID); $cat = $cat[0];
$cats = get_category_parents($cat, TRUE, $delimiter);
$cats = str_replace('
', '' . $linkAfter, $cats);
echo $cats;
printf($link, get_permalink($parent), $parent->post_title);
if ($showCurrent == 1) echo $delimiter . $before . get_the_title() . $after;
} elseif ( is_page() && !$post->post_parent ) {
if ($showCurrent == 1) echo $before . get_the_title() . $after;
} elseif ( is_page() && $post->post_parent ) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = sprintf($link, get_permalink($page->ID), get_the_title($page->ID));
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
for ($i = 0; $i < count($breadcrumbs); $i++) {
echo $breadcrumbs[$i];
if ($i != count($breadcrumbs)-1) echo $delimiter;
}
if ($showCurrent == 1) echo $delimiter . $before . get_the_title() . $after;
} elseif ( is_tag() ) {
echo $before . sprintf($text['tag'], single_tag_title('', false)) . $after;
} elseif ( is_author() ) {
global $author;
$userdata = get_userdata($author);
echo $before . sprintf($text['author'], $userdata->display_name) . $after;
} elseif ( is_404() ) {
echo $before . $text['404'] . $after;
}
if ( get_query_var('paged') ) {
if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ' (';
echo __('Page','czs') . ' ' . get_query_var('paged');
if ( is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author() ) echo ')';
}
echo '
';
}
}
?>