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 '…
' . __( 'Read more', 'naturespace' ) . '';} add_filter( 'excerpt_more', 'naturespace_new_excerpt_more' ); if ( ! function_exists( 'naturespace_content_nav' ) ) : /** * Displays navigation to next/previous pages when applicable. * */ function naturespace_content_nav( $html_id ) { global $wp_query; $html_id = esc_attr( $html_id ); if ( $wp_query->max_num_pages > 1 ) : ?> comment_type ) : case 'pingback' : case 'trackback' : ?>
  • id="comment-">

    ', '' ); ?>

  • id="li-comment-">
    %1$s %2$s', get_comment_author_link(), ( $comment->user_id === $post->post_author ) ? '' . __( '(Post author)', 'naturespace' ) . '' : '' ); printf( '', esc_url( get_comment_link( $comment->comment_ID ) ), get_comment_time( 'c' ), // translators: 1: date, 2: time sprintf( __( '%1$s at %2$s', 'naturespace' ), get_comment_date(''), get_comment_time() ) ); ?>
    comment_approved ) : ?>

    __( 'Reply', 'naturespace' ), 'after' => ' ', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    ', '

    ' ); ?>
    $object ) { if ( 0 == $object->menu_item_parent ) { $top_ids[$i] = $object; continue; } if ( ! in_array( $object->menu_item_parent, $ids ) ) { $objects[$i]->classes[] = 'first-menu-item'; $ids[] = $object->menu_item_parent; } if ( in_array( 'first-menu-item', $object->classes ) ) continue; $parent_ids[$i] = $object->menu_item_parent; } $sanitized_parent_ids = array_unique( array_reverse( $parent_ids, true ) ); foreach ( $sanitized_parent_ids as $i => $id ) $objects[$i]->classes[] = 'last-menu-item'; return $objects; } /** * Include the TGM_Plugin_Activation class. * */ if ( current_user_can ( 'install_plugins' ) ) { require_once get_template_directory() . '/class-tgm-plugin-activation.php'; add_action( 'naturespace_register', 'naturespace_my_theme_register_required_plugins' ); function naturespace_my_theme_register_required_plugins() { $plugins = array( array( 'name' => 'Breadcrumb NavXT', 'slug' => 'breadcrumb-navxt', 'required' => false, ), ); $config = array( 'domain' => 'naturespace', 'menu' => 'install-my-theme-plugins', 'strings' => array( 'page_title' => __( 'Install Recommended Plugins', 'naturespace' ), 'menu_title' => __( 'Install Plugins', 'naturespace' ), 'instructions_install' => __( 'The %1$s plugin is required for this theme. Click on the big blue button below to install and activate %1$s.', 'naturespace' ), 'instructions_activate' => __( 'The %1$s is installed but currently inactive. Please go to the plugin administration page page to activate it.', 'naturespace' ), 'button' => __( 'Install %s Now', 'naturespace' ), 'installing' => __( 'Installing Plugin: %s', 'naturespace' ), 'oops' => __( 'Something went wrong with the plugin API.', 'naturespace' ), // */ 'notice_can_install' => __( 'This theme requires the %1$s plugin. Click here to begin the installation process. You may be asked for FTP credentials based on your server setup.', 'naturespace' ), 'notice_cannot_install' => __( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'naturespace' ), 'notice_can_activate' => __( 'This theme requires the %1$s plugin. That plugin is currently inactive, so please go to the plugin administration page to activate it.', 'naturespace' ), 'notice_cannot_activate' => __( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'naturespace' ), 'return' => __( 'Return to Recommended Plugins Installer', 'naturespace' ), ), ); naturespace_tgmpa( $plugins, $config ); }} /** * WooCommerce custom template modifications. * */ if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { function naturespace_woocommerce_modifications() { remove_action ( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 ); } add_action ( 'init', 'naturespace_woocommerce_modifications' ); add_filter ( 'woocommerce_show_page_title', '__return_false' ); } ?>