for posts and comments. add_theme_support( 'automatic-feed-links' ); // This theme supports custom background color and image. $defaults = array( 'default-color' => '', 'default-image' => '', 'wp-head-callback' => '_custom_background_cb', 'admin-head-callback' => '', 'admin-preview-callback' => '' ); add_theme_support( 'custom-background', $defaults ); // This theme supports post thumbnails. add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 1170, 9999 ); // This theme supports a custom header image. $args = array( 'width' => 1800, 'height' => 400, 'flex-width' => true, 'flex-height' => true, 'header-text' => false, 'random-default' => true,); add_theme_support( 'custom-header', $args ); // This theme supports the Title Tag feature. add_theme_support( 'title-tag' ); // This theme supports the WooCommerce plugin. add_theme_support( 'woocommerce' ); global $content_width; if ( ! isset( $content_width ) ) { $content_width = 840; } } add_action( 'after_setup_theme', 'naturespace_setup' ); /** * Enqueues scripts and styles for front-end. * */ function naturespace_scripts_styles() { global $wp_styles, $wp_scripts; // Adds JavaScript if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); if ( get_theme_mod('naturespace_post_entry_format', naturespace_default_options('naturespace_post_entry_format')) == 'Grid - Masonry' ) { if ( is_home() || is_archive() || is_search() ) { wp_enqueue_script( 'jquery-masonry', array( 'jquery' ) ); if ( !is_rtl() ) { wp_enqueue_script( 'naturespace-masonry-settings', get_template_directory_uri() . '/js/masonry-settings.js', array(), '1.0', true ); } else { wp_enqueue_script( 'naturespace-masonry-settings-rtl', get_template_directory_uri() . '/js/masonry-settings-rtl.js', array(), '1.0', true ); }}} wp_enqueue_script( 'naturespace-placeholders', get_template_directory_uri() . '/js/placeholders.js', array(), '2.1.0', true ); wp_enqueue_script( 'naturespace-scroll-to-top', get_template_directory_uri() . '/js/scroll-to-top.js', array( 'jquery' ), '1.0', true ); if ( has_nav_menu( 'main-navigation' ) && get_theme_mod('naturespace_header_layout', naturespace_default_options('naturespace_header_layout')) == 'Centered' && !is_page_template('template-landing-page.php') ) { wp_enqueue_script( 'naturespace-menubox', get_template_directory_uri() . '/js/menubox.js', array(), '1.0', true ); } wp_enqueue_script( 'naturespace-selectnav', get_template_directory_uri() . '/js/selectnav.js', array(), '0.1', true ); wp_enqueue_script( 'naturespace-responsive', get_template_directory_uri() . '/js/responsive.js', array(), '1.0', true ); // Adds CSS wp_enqueue_style( 'naturespace-elegantfont', get_template_directory_uri() . '/css/elegantfont.css' ); wp_enqueue_style( 'naturespace-style', get_stylesheet_uri() ); wp_enqueue_style( 'naturespace-google-font-default', '//fonts.googleapis.com/css?family=Open+Sans&subset=latin,latin-ext,cyrillic' ); if ( class_exists( 'woocommerce' ) ) { wp_enqueue_style( 'naturespace-woocommerce-custom', get_template_directory_uri() . '/css/woocommerce-custom.css' ); } } add_action( 'wp_enqueue_scripts', 'naturespace_scripts_styles' ); /** * Backwards compatibility for older WordPress versions which do not support the Title Tag feature. * */ if ( ! function_exists( '_wp_render_title_tag' ) ) { function naturespace_wp_title( $title, $sep ) { if ( is_feed() ) return $title; $title .= get_bloginfo( 'name' ); $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) $title = "$title $sep $site_description"; return $title; } add_filter( 'wp_title', 'naturespace_wp_title', 10, 2 ); } /** * Register our menu. * */ function naturespace_register_my_menu() { register_nav_menu( 'main-navigation', __( 'Main Header Menu', 'naturespace' ) ); } add_action( 'after_setup_theme', 'naturespace_register_my_menu' ); /** * Register our sidebars and widgetized areas. * */ function naturespace_widgets_init() { register_sidebar( array( 'name' => __( 'Right Sidebar', 'naturespace' ), 'id' => 'sidebar-1', 'description' => __( 'Right sidebar which appears on all posts and pages.', 'naturespace' ), 'before_widget' => '
', 'before_title' => ' ', ) ); register_sidebar( array( 'name' => __( 'Footer left widget area', 'naturespace' ), 'id' => 'sidebar-2', 'description' => __( 'Left column with widgets in footer.', 'naturespace' ), 'before_widget' => ' ', 'before_title' => ' ', ) ); register_sidebar( array( 'name' => __( 'Footer middle widget area', 'naturespace' ), 'id' => 'sidebar-3', 'description' => __( 'Middle column with widgets in footer.', 'naturespace' ), 'before_widget' => ' ', 'before_title' => ' ', ) ); register_sidebar( array( 'name' => __( 'Footer right widget area', 'naturespace' ), 'id' => 'sidebar-4', 'description' => __( 'Right column with widgets in footer.', 'naturespace' ), 'before_widget' => ' ', 'before_title' => ' ', ) ); register_sidebar( array( 'name' => __( 'Footer notices', 'naturespace' ), 'id' => 'sidebar-5', 'description' => __( 'The line for copyright and other notices below the footer widget areas. Insert here one Text widget. The "Title" field at this widget should stay empty.', 'naturespace' ), 'before_widget' => ' ', 'before_title' => '', 'after_title' => '', ) ); } add_action( 'widgets_init', 'naturespace_widgets_init' ); /** * Post excerpt settings. * */ function naturespace_custom_excerpt_length( $length ) { if (get_theme_mod('naturespace_excerpt_length') != '') { return esc_attr(get_theme_mod('naturespace_excerpt_length')); } else { return 40; } } add_filter( 'excerpt_length', 'naturespace_custom_excerpt_length', 20 ); function naturespace_new_excerpt_more( $more ) { global $post; return '…', '' ); ?>