/**
* SiteOrigin North functions and definitions.
*
* @package siteorigin-north
* @license GPL 2.0
*/
define( 'SITEORIGIN_THEME_VERSION', '1.7.6' );
define( 'SITEORIGIN_THEME_JS_PREFIX', '.min' );
define( 'SITEORIGIN_THEME_CSS_PREFIX', '.min' );
// The settings manager.
include get_template_directory() . '/inc/settings/settings.php';
if ( ! function_exists( 'siteorigin_north_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 siteorigin_north_setup() {
load_theme_textdomain( 'siteorigin-north', 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' );
/*
* Enable support for the custom logo.
*/
add_theme_support( 'custom-logo' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 650, 650 );
add_image_size( 'north-thumbnail-no-sidebar', 1040, 650, true );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary Menu', 'siteorigin-north' ),
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'comment-form',
'comment-list',
'gallery',
'caption',
) );
/*
* Enable support for Post Formats.
* See http://codex.wordpress.org/Post_Formats
*/
add_theme_support( 'post-formats', array(
'aside',
'image',
'video',
'quote',
'link',
'gallery'
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'siteorigin_north_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
// Allowing use of shortcodes in taxonomy descriptions
add_filter( 'term_description', 'shortcode_unautop');
add_filter( 'term_description', 'do_shortcode' );
// Add support for WooCommerce.
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-slider' );
if ( ! defined( 'SITEORIGIN_PANELS_VERSION' ) ) {
// Only include panels lite if the panels plugin doesn't exist.
include get_template_directory() . '/inc/panels-lite/panels-lite.php';
}
add_theme_support( 'siteorigin-panels', array(
'home-page' => true,
'responsive' => ! siteorigin_setting( 'responsive_disabled' ),
) );
// We'll use archive settings
add_theme_support( 'siteorigin-template-settings' );
}
endif; // siteorigin_north_setup
add_action( 'after_setup_theme', 'siteorigin_north_setup' );
if ( ! function_exists( 'siteorigin_north_premium_setup' ) ) :
/**
* Add support for premium theme components
*/
function siteorigin_north_premium_setup() {
// This theme supports the no attribution addon
add_theme_support( 'siteorigin-premium-no-attribution', array(
'filter' => 'siteorigin_north_footer_credits',
'enabled' => siteorigin_setting( 'branding_attribution' ),
'siteorigin_setting' => 'branding_attribution'
) );
// This theme supports the no attribution addon
add_theme_support( 'siteorigin-premium-ajax-comments', array(
'enabled' => siteorigin_setting( 'blog_ajax_comments' ),
'siteorigin_setting' => 'blog_ajax_comments'
) );
}
endif;
add_action( 'after_setup_theme', 'siteorigin_north_premium_setup' );
if ( ! function_exists( 'siteorigin_north_content_width' ) ) :
/**
* 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 siteorigin_north_content_width() {
global $content_width;
$content_width = apply_filters( 'siteorigin_north_content_width', 650 );
}
endif;
add_action( 'after_setup_theme', 'siteorigin_north_content_width', 0 );
if ( ! function_exists( 'siteorigin_north_post_class_filter' ) ) :
/**
* Filter post classes as required.
* @link https://codex.wordpress.org/Function_Reference/post_class.
*/
function siteorigin_north_post_class_filter( $classes ) {
$classes[] = 'post';
// Resolves structured data issue in core. See https://core.trac.wordpress.org/ticket/28482.
if ( is_page() ) {
$class_key = array_search( 'hentry', $classes );
if ( $class_key !== false) {
unset( $classes[ $class_key ] );
}
}
$classes = array_unique( $classes );
return $classes;
}
endif;
add_filter( 'post_class', 'siteorigin_north_post_class_filter' );
if ( ! function_exists( 'siteorigin_north_disable_responsive' ) ) :
/**
* Disable responsive layout.
*/
function siteorigin_north_disable_responsive() {
if ( siteorigin_setting( 'responsive_disabled' ) == false ) {
echo '';
}
}
endif;
add_action( 'wp_head', 'siteorigin_north_disable_responsive', 0 );
if ( ! function_exists( 'siteorigin_north_widgets_init' ) ) :
/**
* Register widget area.
*
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
*/
function siteorigin_north_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Main Sidebar', 'siteorigin-north' ),
'id' => 'main-sidebar',
'description' => esc_html__( 'Visible on posts and pages that use the default layout.', 'siteorigin-north' ),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Widgets', 'siteorigin-north' ),
'id' => 'footer-sidebar',
'description' => esc_html__( 'A column will be automatically assigned to each widget inserted.', 'siteorigin-north' ),
'before_widget' => '',
'before_title' => '