'ffffff',
'default-image' => '',
) ) );
add_editor_style('/inc/custom-editor-style.css');
function codon_custom_excerpt_length( $length ) {
// checks for and sets the custom excerpt length
if ( get_theme_mod ('excerpt-length' ) != null ) {
return get_theme_mod ('excerpt-length' );
} else {
return null;
}
}
add_filter( 'excerpt_length', 'codon_custom_excerpt_length', 999 );
}
endif; // codon_setup
add_action( 'after_setup_theme', 'codon_setup' );
/**
* Register widget area.
*
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
*/
function codon_widgets_init() {
if ( get_theme_mod ('header-widget') != 'off' && get_theme_mod ('header-style') == 'traditional' ) {
register_sidebar(array(
'name' => __( 'Header Widget', 'codon' ),
'id' => 'header-widget',
'description' => __( 'Widgets in this area will be shown on the right side of the header (Traditional header-style only).', 'codon' ),
'before_widget' => '
',
'before_title' => '',
));
}
register_sidebar(array(
'name' => __( 'Page Sidebar', 'codon' ),
'id' => 'sidebar',
'description' => __( 'Widgets in this area will be shown on pages.', 'codon' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
));
if ( get_theme_mod ('post-style') != 'full' ) {
register_sidebar(array(
'name' => __( 'Post Sidebar', 'codon' ),
'id' => 'post-sidebar',
'description' => __( 'Widgets in this area will be shown on posts and archives.', 'codon' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
));
}
if ( get_theme_mod ('archive-post-sidebar') != 'off' ) {
register_sidebar(array(
'name' => __( 'Archive Sidebar', 'codon' ),
'id' => 'archive-sidebar',
'description' => __( 'Widgets in this area will be shown on archive pages.', 'codon' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
));
}
register_sidebar(array(
'name' => __( 'Home Sidebar', 'codon' ),
'id' => 'home-sidebar',
'description' => __( 'Widgets in this area will be shown on the homepage.', 'codon' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
));
register_sidebar(array(
'name' => __( 'Below Posts' , 'codon' ),
'id' => 'belowposts-sidebar',
'description' => __( 'Widgets in this area will be shown beneath the blog post type. Use this for sharing, related articles and more.', 'codon' ),
'before_title' => '',
'before_widget' => '',
'after_widget' => '
',
));
if ( get_theme_mod ('footer-widgets' ) == 'on' ) {
// makes sure footer widgets are turned on
register_sidebar(array(
'name' => __( 'Footer Widget 1', 'codon' ),
'id' => 'footer-widget-1',
'description' => __( 'Widgets in this area will show up in the leftmost footer column.', 'codon' ),
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => __( 'Footer Widget 2', 'codon' ),
'id' => 'footer-widget-2',
'description' => __( 'Widgets in this area will show up in the middle footer column.', 'codon' ),
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => __( 'Footer Widget 3', 'codon' ),
'id' => 'footer-widget-3',
'description' => __( 'Widgets in this area will show up in the right footer column.', 'codon' ),
'before_widget' => '',
'before_title' => '',
));
}
}
add_action( 'widgets_init', 'codon_widgets_init' );
// registers then enqueues scripts and styles
function codon_scripts() {
$protocol = is_ssl() ? 'https' : 'http';
// enqueing styles
wp_enqueue_style( 'codon-font-awesome', get_template_directory_uri() . '/stylesheets/font-awesome.min.css', array(), '4.3', 'all' );
wp_enqueue_style( 'codon-google-fonts', "$protocol://fonts.googleapis.com/css?family=Open+Sans:700,400|Ubuntu:300,400,500,700" );
wp_enqueue_style( 'codon-foundation-style', get_template_directory_uri() . '/stylesheets/foundation.min.css', array(), '5.5.1', 'all' );
wp_enqueue_style( 'style', get_stylesheet_uri() );
// enqueing scripts
wp_enqueue_script( 'codon-scripts', get_template_directory_uri() . '/js/codon-scripts.js', array('jquery'), '1.1.1', true );
wp_enqueue_script( 'codon-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '1.1.1', true );
wp_enqueue_script( 'codon-modernizr', get_template_directory_uri() . '/js/modernizr.js', array(), '3.2', true );
wp_enqueue_script( 'codon-fastclick', get_template_directory_uri() . '/js/vendor/fastclick.js', array(), '1.1.1', false );
wp_enqueue_script( 'codon-foundation', get_template_directory_uri() . '/js/foundation.min.js', array('jquery'), '5.5.1', true );
wp_enqueue_script( 'codon-foundation-init', get_template_directory_uri() . '/js/foundation-init.js', array(), '1.1.1', true );
if ( get_theme_mod ('footer-top-return' ) == 'on' ) {
wp_enqueue_script ( 'codon-top-scroll', get_template_directory_uri() . '/js/top-return.js', array( 'jquery' ), '1.1.1', true);
}
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
$codon_options = '';
if ( !is_singular() && get_theme_mod ('infinite-scroll') == 'on' ) {
// enqueues script if infinite scroll is active
wp_enqueue_script ('codon-infinite-scroll', get_template_directory_uri() . '/js/jquery.infinitescroll.js', array('jquery'), '2.0.2', true);
wp_enqueue_script ('codon-infinite-scroll-init', get_template_directory_uri() . '/js/infinite-init.js', array('jquery'), '1.1.1', true);
}
if ( get_theme_mod ('infinite-scroll') == 'off' ) {
// loads fallback disabling script if infinite scroll is disabled
wp_enqueue_script( 'codon-scroll-disable', get_template_directory_uri() . '/js/jquery.scroll-disable.js', array('jquery'), '1.1.1', true );
}
}
add_action( 'wp_enqueue_scripts', 'codon_scripts', 0 );
// modifies the password form for consistent button styling
function codon_password_form() {
global $post;
$label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID );
$output = '';
return $output;
}
add_filter( 'the_password_form', 'codon_password_form' );
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
function codon_default_mods () {
if ( get_theme_mod ('header-style') == null ) {
$header_style = 'traditional';
} else {
$header_style = get_theme_mod ('header-style');
}
if ( get_theme_mod ('header-widget') == null ) {
$header_widget = 'on';
} else {
$header_widget = get_theme_mod ('header-widget');
}
if ( get_theme_mod ('codon-logo') == null ) {
$codon_logo = '';
} else {
$codon_logo = get_theme_mod ('codon-logo');
}
if ( get_theme_mod ('header-description') == null ) {
$header_description = 'on';
} else {
$header_description = get_theme_mod ('header-description');
}
if ( get_theme_mod ('infinite-scroll') == null ) {
$infinite_scroll = 'on';
} else {
$infinite_scroll = get_theme_mod ('infinite-scroll');
}
if ( get_theme_mod ('excerpt-length') == null ) {
$excerpt_length = '55';
} else {
$excerpt_length = get_theme_mod ('excerpt-length');
}
if ( get_theme_mod ('single-post-meta') == null ) {
$single_post_meta = 'on';
} else {
$single_post_meta = get_theme_mod ('single-post-meta');
}
if ( get_theme_mod ('post-style') == null ) {
$post_style = 'has-sidebar';
} else {
$post_style = get_theme_mod ('post-style');
}
if ( get_theme_mod ('post-breadcrumbs') == null ) {
$post_breadcrumbs = 'on';
} else {
$post_breadcrumbs = get_theme_mod ('post-breadcrumbs');
}
if ( get_theme_mod ('page-breadcrumbs') == null ) {
$page_breadcrumbs = 'on';
} else {
$page_breadcrumbs = get_theme_mod ('page-breadcrumbs');
}
if ( get_theme_mod ('post-navigation') == null ) {
$post_navigationn = 'on';
} else {
$post_navigationn = get_theme_mod ('post-navigation');
}
if ( get_theme_mod ('authorbox') == null ) {
$authorbox = 'on';
} else {
$authorbox = get_theme_mod ('authorbox');
}
if ( get_theme_mod ('post-display') == null ) {
$post_display = 'blog-style';
} else {
$post_display = get_theme_mod ('post-display');
}
if ( get_theme_mod ('archive-post-sidebar') == null ) {
$archive_post_sidebar = 'on';
} else {
$archive_post_sidebar = get_theme_mod ('archive-post-sidebar');
}
if ( get_theme_mod ('archive-post-meta') == null ) {
$archive_post_meta = 'on';
} else {
$archive_post_meta = get_theme_mod ('archive-post-meta');
}
if ( get_theme_mod ('archive-post-content') == null ) {
$archive_post_content = 'full';
} else {
$archive_post_content = get_theme_mod ('archive-post-content');
}
if ( get_theme_mod ('archive-post-thumnails') == null ) {
$archive_post_thumbnails = 'off';
} else {
$archive_post_thumbnails = get_theme_mod ('archive-post-thumnails');
}
if ( get_theme_mod ('footer-credit') == null ) {
$footer_credit = 'on';
} else {
$footer_credit = get_theme_mod ('footer-credit');
}
if ( get_theme_mod ('footer-widgets') == null ) {
$footer_widgets = 'on';
} else {
$footer_widgets = get_theme_mod ('footer-widgets');
}
if ( get_theme_mod ('footer-menu') == null ) {
$footer_menu = 'on';
} else {
$footer_menu = get_theme_mod ('footer-menu');
}
if ( get_theme_mod ('footer-top-return') == null ) {
$footer_top_return = 'on';
} else {
$footer_top_return = get_theme_mod ('footer-top-return');
}
if ( get_theme_mod ('footer-socialblock') == null ) {
$footer_socialblock = 'off';
} else {
$footer_socialblock = get_theme_mod ('footer-socialblock');
}
if ( get_theme_mod ('header-search') == null ) {
$header_search = 'on';
} else {
$header_search = get_theme_mod ('header-search');
}
set_theme_mod( 'header-style', $header_style );
set_theme_mod( 'header-widget', $header_widget );
set_theme_mod( 'codon-logo', $codon_logo );
set_theme_mod( 'header-search', $header_search );
set_theme_mod( 'header-description', $header_description );
set_theme_mod( 'infinite-scroll', $infinite_scroll );
set_theme_mod( 'excerpt-length', $excerpt_length );
set_theme_mod( 'single-post-meta', $single_post_meta );
set_theme_mod( 'post-style', $post_style );
set_theme_mod( 'post-breadcrumbs', $post_breadcrumbs );
set_theme_mod( 'page-breadcrumbs', $page_breadcrumbs );
set_theme_mod( 'post-navigation', $post_navigationn );
set_theme_mod( 'authorbox', $authorbox );
set_theme_mod( 'post-display', $post_display );
set_theme_mod( 'archive-post-sidebar', $archive_post_sidebar );
set_theme_mod( 'archive-post-meta', $archive_post_meta );
set_theme_mod( 'archive-post-content', $archive_post_content );
set_theme_mod( 'archive-post-thumbnails', $archive_post_thumbnails );
set_theme_mod( 'footer-credit', $footer_credit );
set_theme_mod( 'footer-widgets', $footer_widgets );
set_theme_mod( 'footer-menu', $footer_menu );
set_theme_mod( 'footer-top-return', $footer_top_return );
set_theme_mod( 'footer-socialblock', $footer_socialblock );
}
add_action('after_switch_theme', 'codon_default_mods');