* @copyright Copyright (c) 2015 - 2016, ThemeMunk
* @link http://thememunk.com/theme/simplex-munk
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package simplex-munk
*/
if ( ! function_exists( 'simplex_munk_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function simplex_munk_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on simplex, use a find and replace
* to change 'simplex-munk' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'simplex-munk', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded
tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
// add custmo logo support
add_theme_support( 'custom-logo', array(
'height' => 70,
'width' => 375,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
) );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'simplex-munk' ),
) );
/*
* Switch 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',
'gallery',
'caption',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'simplex__munk_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
add_image_size( 'simplex-munk-feature', 960, 505, true );
add_image_size( 'simplex-munk-with-sidebar', 845, 515, true );
}
endif;
add_action( 'after_setup_theme', 'simplex_munk_setup' );
/* Change Excerpt length */
function simplex_munk_excerpt_length( $length ) {
return 25;
}
add_filter( 'excerpt_length', 'simplex_munk_excerpt_length', 999 );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function simplex_munk_content_width() {
$GLOBALS['content_width'] = apply_filters( 'simplex_munk_content_width', 670 );
}
add_action( 'after_setup_theme', 'simplex_munk_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function simplex_munk_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Right Sidebar', 'simplex-munk' ),
'id' => 'right-sidebar',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer One', 'simplex-munk' ),
'id' => 'footer-one',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Two', 'simplex-munk' ),
'id' => 'footer-two',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Three', 'simplex-munk' ),
'id' => 'footer-three',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'simplex_munk_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function simplex_munk_scripts() {
wp_enqueue_style( 'simplex-munk-style', get_stylesheet_uri() );
wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/css/font-awesome.css' );
wp_enqueue_style( 'simplex-munk-responsive-style', get_template_directory_uri() . '/css/responsive.css' );
wp_enqueue_style( 'meanmenu', get_template_directory_uri() . '/css/meanmenu.css' );
wp_enqueue_style( 'asap', 'https://fonts.googleapis.com/css?family=Asap:400,700', false );
wp_enqueue_style( 'playfair-display', 'https://fonts.googleapis.com/css?family=Playfair+Display:400,900,700', false );
wp_enqueue_script( 'simplex-munk-js', get_template_directory_uri() . '/js/simplex-munk.js', array('jquery'), '20160125', true );
wp_enqueue_script( 'meanmenu', get_template_directory_uri() . '/js/jquery.meanmenu.js', array('jquery'), '20160125', true );
wp_enqueue_script( 'navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
/**
* Registers an editor stylesheet for the theme.
*/
function simplex_munk_theme_add_editor_styles() {
add_editor_style( 'css/editor-style.css' );
}
add_action( 'admin_init', 'simplex_munk_theme_add_editor_styles' );
}
add_action( 'wp_enqueue_scripts', 'simplex_munk_scripts' );
/**
* Footer Credits
*/
function simplex_munk_footer_credit(){
$text = '';
$text .= esc_html__( 'Copyright © ', 'simplex-munk' ) . date_i18n('Y');
$text .= ' ' . esc_html( get_bloginfo( 'name' ) ) . '. ';
$text .= '';
$text .= '' . esc_html__( 'Theme Simplex Munk by ThemeMunk', 'simplex-munk' ) .'. ';
$text .= sprintf( esc_html__( 'Powered by %s', 'simplex-munk' ), 'WordPress.' );
$text .= '';
echo apply_filters( 'simplex_munk_footer_text', $text );
}
add_action( 'simplex_munk_footer', 'simplex_munk_footer_credit' );
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';