__( 'Header', 'codeillust' ),
'footer' => __( 'Footer', 'codeillust' )
) );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'html5', array( 'search-form' ) );
add_theme_support( "title-tag" );
$args = array(
'width' => 1600,
'height' => 250,
);
add_theme_support( "custom-header", $args);
add_theme_support( "custom-background");
add_editor_style();
add_theme_support( 'post-formats', array(
'aside', 'image', 'video', 'audio', 'quote', 'link', 'gallery', 'chat',
) );
load_theme_textdomain('codeillust', get_template_directory() . '/languages');
}
endif; // codeillust_setup
add_action( 'after_setup_theme', 'codeillust_setup' );
/* Theme stylesheet & javascript */
if ( ! function_exists( 'codeillust_scripts' ) ) :
function codeillust_scripts() {
wp_enqueue_style( 'codeillust_bootstrap_css', get_template_directory_uri() . '/assets/css/bootstrap.css', array(), '' );
wp_enqueue_style( 'codeillust_header_common_css', get_template_directory_uri() . '/assets/css/header-common.css', array(), '' );
wp_enqueue_style( 'codeillust_footer_common_css', get_template_directory_uri() . '/assets/css/footer-common.css', array(), '' );
wp_enqueue_style( 'codeillust_base_common_css', get_template_directory_uri() . '/assets/css/base-common.css', array(), '' );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
wp_enqueue_script( 'codeillust_bootstrap_js', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array('jquery'), '', true );
wp_enqueue_script( 'codeillust_script_js', get_template_directory_uri() . '/assets/js/script.js', array('jquery'), '', true );
}
endif; // codeillust_scripts
add_action( 'wp_enqueue_scripts', 'codeillust_scripts' );
/* Theme Widget */
if ( ! function_exists( 'codeillust_widgets' ) ) :
function codeillust_widgets() {
register_sidebar( array(
'name' => __('Post','codeillust'),
'id' => 'codeillust_post_widget',
'description' => __('Post Widget', 'codeillust' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __('Footer Widget','codeillust').'01',
'id' => 'codeillust_footer_widget_01',
'description' => __('Footer Widget', 'codeillust' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __('Footer Widget','codeillust').'02',
'id' => 'codeillust_footer_widget_02',
'description' => __('Footer Widget', 'codeillust' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __('Footer Widget','codeillust').'03',
'id' => 'codeillust_footer_widget_03',
'description' => __('Footer Widget', 'codeillust' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __('Footer Widget','codeillust').'04',
'id' => 'codeillust_footer_widget_04',
'description' => __('Footer Widget', 'codeillust' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
endif; // codeillust_widgets
add_action( 'widgets_init', 'codeillust_widgets' );
/* theme title */
if ( ! function_exists( 'codeillust_wp_title' ) ) :
function codeillust_wp_title( $title, $sep ) {
global $paged, $page;
if ( is_feed() ) {return $title;}
$title .= get_bloginfo( 'name', 'display' );
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) ) {
$title = "$title $sep $site_description";
}
if ( $paged >= 2 || $page >= 2 ) {
$title = "$title $sep " . sprintf( __( 'Page %s', 'codeillust' ), max( $paged, $page ) );
}
return $title;
}
endif; // codeillust_wp_title
add_filter( 'wp_title', 'codeillust_wp_title', 10, 2 );
/* post pagination */
if ( ! function_exists( 'codeillust_pagination' ) ) :
function codeillust_pagination() {
global $wp_query;
$big = 999999999;
$pages = paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'prev_next' => false,
'type' => 'array',
'prev_next' => TRUE,
'prev_text' => '',
'next_text' => '',
) );
if( is_array( $pages ) ) {
$paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged');
echo '';
}
}
endif; // codeillust_pagination
// theme excerpt
if ( ! function_exists( 'codeillust_custom_excerpt_length' ) ) :
function codeillust_custom_excerpt_length( $length ) {
return 300;
}
endif; // codeillust_custom_excerpt_length
add_filter( 'excerpt_length', 'codeillust_custom_excerpt_length', 999 );
//theme excerpt more
if ( ! function_exists( 'codeillust_new_excerpt_more' ) ) :
function codeillust_new_excerpt_more( $more ) {
return '...';
}
endif; // codeillust_new_excerpt_more
add_filter('excerpt_more', 'codeillust_new_excerpt_more');
//Comments list
if ( ! function_exists( 'codeillust_comment_li' ) ) :
function codeillust_comment_li( $comment, $args, $depth ) {
global $post;
$GLOBALS['comment'] = $comment;
?>
>
class="comment">
' '.__( 'Leave a Reply', 'codeillust' ),
'title_reply_to' => __( 'Leave a Reply to %s', 'codeillust' ),
'cancel_reply_link' => ' '.__( 'Cancel', 'codeillust' ),
'label_submit' => __( 'Post Comment', 'codeillust' ),
'class_submit' => 'btn btn-primary',
'comment_field' => '
',
'comment_notes_before' => '',
'fields' => apply_filters( 'comment_form_default_fields', array(
'author' => '
',
'email' => '',
'url' => '
',
)),
);
comment_form($comments_args);
}
endif; // codeillust_comment_form
//theme search form
if ( ! function_exists( 'codeillust_search_form' ) ) :
function codeillust_search_form( $form ) {
$form = '
';
return $form;
}
endif; // codeillust_search_form
add_filter( 'get_search_form', 'codeillust_search_form' );