'ffffff', ) ); // Title tag support add_theme_support( 'title-tag' ); // Add nav menu register_nav_menu( 'main-menu', __( 'Main menu', 'mcluhan' ) ); register_nav_menu( 'social-menu', __( 'Social links', 'mcluhan' ) ); // Add excerpts to pages add_post_type_support( 'page', array( 'excerpt' ) ); // HTML5 semantic markup add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) ); // Make the theme translation ready load_theme_textdomain( 'mcluhan', get_template_directory() . '/languages' ); } } // End if(). add_action( 'after_setup_theme', 'mcluhan_setup' ); /* INCLUDE REQUIRED FILES ------------------------------------------------ */ // Handle Customizer settings require get_template_directory() . '/inc/classes/class-mcluhan-customize.php'; /* ----------------------------------------------------------------------------------------------- ENQUEUE STYLES --------------------------------------------------------------------------------------------------- */ if ( ! function_exists( 'mcluhan_load_style' ) ) : function mcluhan_load_style() { $dependencies = array(); $theme_version = wp_get_theme( 'mcluhan' )->get( 'Version' ); /** * Translators: If there are characters in your language that are not * supported by the theme fonts, translate this to 'off'. Do not translate * into your own language. */ $google_fonts = _x( 'on', 'Google Fonts: on or off', 'mcluhan' ); if ( 'off' !== $google_fonts ) { // Register Google Fonts wp_register_style( 'mcluhan-fonts', '//fonts.googleapis.com/css?family=Archivo:400,400i,600,600i,700,700i&subset=latin-ext', false, 1.0, 'all' ); $dependencies[] = 'mcluhan-fonts'; } wp_register_style( 'fontawesome', get_template_directory_uri() . '/assets/css/font-awesome.css', null ); $dependencies[] = 'fontawesome'; wp_enqueue_style( 'mcluhan-style', get_template_directory_uri() . '/style.css', $dependencies, $theme_version ); } add_action( 'wp_enqueue_scripts', 'mcluhan_load_style' ); endif; /* ----------------------------------------------------------------------------------------------- ADD EDITOR STYLES --------------------------------------------------------------------------------------------------- */ if ( ! function_exists( 'mcluhan_add_editor_styles' ) ) : function mcluhan_add_editor_styles() { $editor_styles = array( 'assets/css/mcluhan-classic-editor-styles.css' ); /** * Translators: If there are characters in your language that are not * supported by the theme fonts, translate this to 'off'. Do not translate * into your own language. */ $google_fonts = _x( 'on', 'Google Fonts: on or off', 'mcluhan' ); if ( 'off' !== $google_fonts ) { $editor_styles[] = '//fonts.googleapis.com/css?family=Archivo:400,400i,600,700,700i&subset=latin-ext'; } add_editor_style( $editor_styles ); } add_action( 'init', 'mcluhan_add_editor_styles' ); endif; /* ----------------------------------------------------------------------------------------------- DEACTIVATE DEFAULT CORE GALLERY STYLES Only applies to the shortcode gallery. --------------------------------------------------------------------------------------------------- */ add_filter( 'use_default_gallery_style', '__return_false' ); /* ENQUEUE SCRIPTS ------------------------------------------------ */ if ( ! function_exists( 'mcluhan_enqueue_scripts' ) ) : function mcluhan_enqueue_scripts() { $theme_version = wp_get_theme( 'mcluhan' )->get( 'Version' ); wp_enqueue_script( 'mcluhan_global', get_template_directory_uri() . '/assets/js/global.js', array( 'jquery', 'imagesloaded', 'masonry' ), $theme_version, true ); // Enqueue comment reply if ( ( ! is_admin() ) && is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } global $wp_query; // AJAX PAGINATION wp_localize_script( 'mcluhan_global', 'mcluhan_ajaxpagination', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ), 'query_vars' => wp_json_encode( $wp_query->query ), ) ); } add_action( 'wp_enqueue_scripts', 'mcluhan_enqueue_scripts' ); endif; /* ----------------------------------------------------------------------------------------------- FILTER POST_CLASS --------------------------------------------------------------------------------------------------- */ if ( ! function_exists( 'mcluhan_post_classes' ) ) { function mcluhan_post_classes( $classes ) { // Class indicating presence/lack of post thumbnail $classes[] = ( has_post_thumbnail() ? 'has-thumbnail' : 'missing-thumbnail' ); // Class indicating lack of title if ( ! get_the_title() ) $classes[] = 'no-title'; return $classes; } } add_action( 'post_class', 'mcluhan_post_classes' ); /* ----------------------------------------------------------------------------------------------- FILTER BODY_CLASS --------------------------------------------------------------------------------------------------- */ if ( ! function_exists( 'mcluhan_body_classes' ) ) { function mcluhan_body_classes( $classes ) { // Check whether we're in the customizer preview if ( is_customize_preview() ) { $classes[] = 'customizer-preview'; } // Hide social buttons if ( get_theme_mod( 'mcluhan_hide_social' ) ) { $classes[] = 'hide-social'; } // White bg class if ( get_theme_mod( 'mcluhan_accent_color' ) == '#ffffff' && ( ! get_background_color() || get_background_color() == 'ffffff' ) ) { $classes[] = 'white-bg'; } // Check whether the custom backgrounds are both set to the same thing if ( get_theme_mod( 'mcluhan_accent_color' ) && get_background_color() && ltrim( get_theme_mod( 'mcluhan_accent_color' ), '#' ) == get_background_color() ) { $classes[] = 'same-custom-bgs'; } // Dark sidebar text if ( get_theme_mod( 'mcluhan_dark_sidebar_text' ) ) { $classes[] = 'dark'; } // Add short class for resume page template if ( is_page_template( 'resume-page-template.php' ) ) { $classes[] = 'resume-template'; } // Add short class for full width page template if ( is_page_template( 'full-width-page-template.php' ) ) { $classes[] = 'full-width-template'; } return $classes; } } // End if(). add_action( 'body_class', 'mcluhan_body_classes' ); /* ----------------------------------------------------------------------------------------------- NO-JS CLASS --------------------------------------------------------------------------------------------------- */ if ( ! function_exists( 'mcluhan_has_js' ) ) { function mcluhan_has_js() { ?> $string, 'posts_per_page' => 5, 'post_status' => 'publish', ); $ajax_query = new WP_Query( $args ); if ( $ajax_query->have_posts() ) { ?>