for posts and comments. add_theme_support( 'automatic-feed-links' ); /* * Switches default core markup for search form, comment form, * and comments to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) ); /* * This theme supports all available post formats by default. * See http://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'aside', 'audio', 'quote', 'video', 'link' ) ); /* Custom Header */ add_theme_support('custom-header',array( 'default-image' => get_template_directory_uri().'/img/header-img.jpg', 'height' => 300, 'width' => 1920, 'flex-width' => true, 'flex-height' => false, 'header-text' => false, 'random-default' => false )); // This theme uses wp_nav_menu() in one location. register_nav_menus(array( 'top-menu' => __( 'Top Menu', 'calm' ), 'mobile-menu' => __('Mobile Top Menu', 'calm'), 'footer-menu' => __('Footer Menu', 'calm') )); /* * This theme uses a custom image size for featured images, displayed on * "standard" posts and pages. */ add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 220, 340, true ); add_image_size( 'image',770, 335, true ); } add_action( 'after_setup_theme', 'calm_setup' ); function calm_scripts_styles() { /* * Adds JavaScript to pages with the comment form to support * sites with threaded comments (when in use). */ if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); wp_enqueue_script('calm-custom',get_template_directory_uri().'/js/calm-custom.js',array('jquery'),'',true); wp_enqueue_script('smoothScroll',get_template_directory_uri().'/js/SmoothScroll.js',array('jquery'),'',true); // Add fonts, icons used in the main stylesheet. wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/css/font-awesome.css', array(), '' ); wp_enqueue_style( 'bootstrap-theme', get_template_directory_uri() . '/css/bootstrap-theme.css', array(), '' ); wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.css', array(), '' ); // Loads our main stylesheet. wp_enqueue_style( 'calm-style', get_stylesheet_uri(), array(), '' ); } add_action( 'wp_enqueue_scripts', 'calm_scripts_styles' ); function calm_wp_title( $title, $sep ) { global $paged, $page; if ( is_feed() ) return $title; // Add the site name. $title .= get_bloginfo( 'name' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title = "$title $sep $site_description"; // Add a page number if necessary. if ( $paged >= 2 || $page >= 2 ) $title = "$title $sep " . sprintf( __( 'Page %s', 'Calm' ), max( $paged, $page ) ); return $title; } add_filter( 'wp_title', 'calm_wp_title', 10, 2 ); /* Excerpt Filter */ function calm_excerpt_length( $length ) { return 110; } add_filter( 'excerpt_length', 'calm_excerpt_length', 999 ); /* Excerpt More */ function new_excerpt_more( $more ) { return ' .....'; } add_filter('excerpt_more', 'new_excerpt_more'); function calm_widgets(){ /* Dynamic Sidebar */ register_sidebar(array( 'id' => 'sidebar', 'name' => __( 'Right Sidebar', 'calm' ), 'description' => __( 'This sidebar is located right side.', 'calm' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); /* Footer Widget 1 */ register_sidebar(array( 'id' => 'footer-1', 'name' => __( 'Left Footer Widget', 'calm' ), 'description' => __( 'This widget is located left side.', 'calm' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); /* Footer Widget 2 */ register_sidebar(array( 'id' => 'footer-2', 'name' => __( 'Right Footer Widget', 'calm' ), 'description' => __( 'This widget is located right side.', 'calm' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); /* Footer Widget 3 */ register_sidebar(array( 'id' => 'footer-3', 'name' => __( 'Middle Footer Widget', 'calm' ), 'description' => __( 'This widget is located center side.', 'calm' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); } add_action('widgets_init', 'calm_widgets'); /* Paging */ if ( ! function_exists( 'calm_paging_nav' ) ) : function calm_paging_nav() { global $wp_query; // Don't print empty markup if there's only one page. if ( $wp_query->max_num_pages < 2 ) return; ?>

'; return $defaults; } add_filter('comment_form_defaults', 'calm_custom_comment_form'); function calm_custom_comment_fields() { $commenter = wp_get_current_commenter(); $req = get_option('require_name_email'); $aria_req = ($req ? " aria-required='true'" : ''); $fields = array( 'author' => '

' . '' . '

', 'email' => '

' . '' . '

', 'url' => '

' . '' . '

' ); return $fields; } add_filter('comment_form_default_fields', 'calm_custom_comment_fields');