FCDM-website-new/wp-content/themes/studio-pro/functions.php

297 lines
9.1 KiB
PHP

<?php
/**
* Studio Pro Theme
*
* This file adds basic functionality to the Studio Pro theme.
*
* @package StudioPro
* @link https://seothemes.com/themes/studio-pro
* @author SEO Themes
* @copyright Copyright © 2017 SEO Themes
* @license GPL-2.0+
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
// Child theme (do not remove).
include_once( get_template_directory() . '/lib/init.php' );
// Define theme constants.
define( 'CHILD_THEME_NAME', 'Studio Pro' );
define( 'CHILD_THEME_URL', 'https://seothemes.com/themes/studio-pro' );
define( 'CHILD_THEME_VERSION', '2.2.2' );
// Set Localization (do not remove).
load_child_theme_textdomain( 'studio-pro', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'studio-pro' ) );
// Remove secondary sidebar.
unregister_sidebar( 'sidebar-alt' );
// Remove unused site layouts.
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-content-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
// Enable support for page excerpts.
add_post_type_support( 'page', 'excerpt' );
// Add custom portfolio image thumbnail size.
add_image_size( 'portfolio', 620, 380, true );
// Enable support for WooCommerce and WooCommerce features.
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
// Enable support for structural wraps.
add_theme_support( 'genesis-structural-wraps', array(
'header',
'menu-primary',
'menu-secondary',
'footer-widgets',
'footer',
) );
// Enable support for Accessibility enhancements.
add_theme_support( 'genesis-accessibility', array(
'404-page',
'drop-down-menu',
'headings',
'rems',
'search-form',
'skip-links',
) );
// Enable support for custom navigation menus.
add_theme_support( 'genesis-menus' , array(
'primary' => __( 'Header Menu', 'studio-pro' ),
) );
// Enable support for viewport meta tag for mobile browsers.
add_theme_support( 'genesis-responsive-viewport' );
// Enable support for after entry widget area.
add_theme_support( 'genesis-after-entry-widget-area' );
// Enable support for Genesis footer widgets.
add_theme_support( 'genesis-footer-widgets', 4 );
// Enable support for Gutenberge wide images.
add_theme_support( 'gutenberg', array(
'wide-images' => true,
) );
// Enable support for default posts and comments RSS feed links.
add_theme_support( 'automatic-feed-links' );
// Enable support for HTML5 markup structure.
add_theme_support( 'html5', array(
'comment-list',
'comment-form',
'search-form',
'gallery',
'caption',
) );
// Enable support for post formats.
add_theme_support( 'post-formats', array(
'aside',
'audio',
'chat',
'gallery',
'image',
'link',
'quote',
'status',
'video',
) );
// Enable support for selective refresh and Customizer edit icons.
add_theme_support( 'customize-selective-refresh-widgets' );
// Enable support for custom background image.
add_theme_support( 'custom-background', array(
'default-color' => 'f4f5f6',
'default-image' => '%1$s/assets/images/background.jpg',
) );
// Enable support for logo option in Customizer > Site Identity.
add_theme_support( 'custom-logo', array(
'height' => 60,
'width' => 240,
'flex-height' => true,
'flex-width' => true,
'header-text' => array( '.site-title', '.site-description' ),
) );
// Display custom logo in site title area.
add_action( 'genesis_site_title', 'the_custom_logo', 0 );
// Enable support for custom header image or video.
add_theme_support( 'custom-header', array(
'header-selector' => '.hero',
'default_image' => get_stylesheet_directory_uri() . '/assets/images/hero.jpg',
'header-text' => true,
'default-text-color' => '30353a',
'width' => 1920,
'height' => 1080,
'flex-height' => true,
'flex-width' => true,
'uploads' => true,
'video' => true,
'wp-head-callback' => 'studio_custom_header',
) );
// Register default header (just in case).
register_default_headers( array(
'child' => array(
'url' => '%2$s/assets/images/hero.jpg',
'thumbnail_url' => '%2$s/assets/images/hero.jpg',
'description' => __( 'Hero Image', 'studio-pro' ),
),
) );
// Register narrow content custom layout.
genesis_register_layout( 'narrow-content', array(
'label' => __( 'Narrow Content', 'studio-pro' ),
'img' => get_stylesheet_directory_uri() . '/assets/images/narrow-content.gif',
) );
// Change order of main stylesheet to override plugin styles.
remove_action( 'genesis_meta', 'genesis_load_stylesheet' );
add_action( 'wp_enqueue_scripts', 'genesis_enqueue_main_stylesheet', 99 );
// Reposition primary navigation menu.
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_after_title_area', 'genesis_do_nav' );
// Reposition the secondary navigation menu.
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
add_action( 'genesis_after_header_wrap', 'genesis_do_subnav' );
// Reposition featured image on archives.
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
add_action( 'genesis_entry_header', 'genesis_do_post_image', 1 );
// Reposition footer widgets inside site footer.
remove_action( 'genesis_before_footer', 'genesis_footer_widget_areas' );
add_action( 'genesis_before_footer_wrap', 'genesis_footer_widget_areas', 5 );
// Enable shortcodes in text widgets.
add_filter( 'widget_text', 'do_shortcode' );
// Remove Genesis Portfolio Pro default styles.
add_filter( 'genesis_portfolio_load_default_styles', '__return_false' );
// Remove one click demo branding.
add_filter( 'pt-ocdi/disable_pt_branding', '__return_true' );
add_action( 'wp_enqueue_scripts', 'studio_scripts_styles', 98 );
/**
* Enqueue theme scripts and styles.
*
* @return void
*/
function studio_scripts_styles() {
// Remove Simple Social Icons CSS (included with theme).
wp_dequeue_style( 'simple-social-icons-font' );
// Google fonts.
wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Playfair+Display|Roboto:300,400,500', array(), CHILD_THEME_VERSION );
// Conditionally load WooCommerce styles.
if ( studio_is_woocommerce_page() ) {
wp_enqueue_style( 'studio-pro-woocommerce', get_stylesheet_directory_uri() . '/assets/styles/min/woocommerce.min.css', array(), CHILD_THEME_VERSION );
}
// Check if debugging is enabled.
$suffix = defined( SCRIPT_DEBUG ) && SCRIPT_DEBUG ? '' : '';
$folder = defined( SCRIPT_DEBUG ) && SCRIPT_DEBUG ? '' : '';
// Enqueue responsive menu script.
wp_enqueue_script( 'studio-pro', get_stylesheet_directory_uri() . '/assets/scripts/' . $folder . 'scripts.' . $suffix . 'js', array( 'jquery' ), CHILD_THEME_VERSION, true );
// Localize responsive menu script.
wp_localize_script( 'studio-pro', 'genesis_responsive_menu', array(
'mainMenu' => __( 'Menu', 'studio-pro' ),
'subMenu' => __( 'Menu', 'studio-pro' ),
'menuIconClass' => null,
'subMenuIconClass' => null,
'menuClasses' => array(
'combine' => array(
'.nav-primary',
'.nav-secondary',
),
),
) );
}
// Load helper functions.
include_once( get_stylesheet_directory() . '/includes/helpers.php' );
// Load miscellaneous functions.
include_once( get_stylesheet_directory() . '/includes/extras.php' );
// Load page header.
include_once( get_stylesheet_directory() . '/includes/header.php' );
// Load widget functions.
include_once( get_stylesheet_directory() . '/includes/widgets.php' );
// Load Customizer settings.
include_once( get_stylesheet_directory() . '/includes/customize.php' );
// Load default settings.
include_once( get_stylesheet_directory() . '/includes/defaults.php' );
// Load recommended plugins.
include_once( get_stylesheet_directory() . '/includes/plugins.php' );
/*
|--------------------------------------------------------------------------
| Begin SEO Themes Custom Development
|--------------------------------------------------------------------------
*/
add_filter( 'genesis_widget_column_classes', 'fcdm_widget_columns' );
/**
* Add additional column class to plugin.
*
* @since 1.0.0
*
* @param array $column_classes Array of column classes.
*
* @return array Modified column classes.
*/
function fcdm_widget_columns( $column_classes ) {
$column_classes[] = 'full-width';
return $column_classes;
}
//* Change the footer text
add_filter('genesis_footer_creds_text', 'sp_footer_creds_filter');
function sp_footer_creds_filter( $creds ) {
$creds = 'Full Circle Digital Marketing [footer_copyright] &middot; Site Crafted By <a href="http://kaitschmidek.com" target="_blank">Kait Schmidek</a> &middot; Theme by <a href="https://seothemes.com/" title="SEO Themes" target="_blank">SEO Themes</a>';
return $creds;
}
function custom_add_google_fonts() {
wp_enqueue_style( 'custom-google-fonts', 'https://fonts.googleapis.com/css?family=Oswald:300|Permanent+Marker', false );
}
add_action( 'wp_enqueue_scripts', 'custom_add_google_fonts' );
/*
|--------------------------------------------------------------------------
| End SEOThemes Custom Development
|--------------------------------------------------------------------------
*/