* @since Kleo 1.0
*/
/***************************************************
* :: Load Kleo framework
***************************************************/
require_once( trailingslashit( get_template_directory() ) . 'kleo-framework/kleo.php' );
if ( ! isset( $content_width ) ) {
$content_width = 1200;
}
/***************************************************
* :: Load Theme specific functions
***************************************************/
require_once( trailingslashit( get_template_directory() ) . 'lib/theme-functions.php' );
/***************************************************
* :: SideKick Integration
***************************************************/
define( 'SK_PRODUCT_ID', 457 );
define( 'SK_ENVATO_PARTNER', 'Qjq0CBU+3zqUohNf6gfTpvfnRX3eCVM+HwoqKeVL4/k=' );
define( 'SK_ENVATO_SECRET', 'RqjBt/YyaTOjDq+lKLWhL10sFCMCJciT9SPUKLBBmso=' );
/**
* Sets up theme defaults and registers the various WordPress features
*
* @uses load_theme_textdomain() For translation/localization support.
* @uses add_editor_style() To add a Visual Editor stylesheet.
* @uses add_theme_support() To add support for post thumbnails, automatic feed links,
* custom background, and post formats.
* @uses register_nav_menu() To add support for navigation menus.
* @uses set_post_thumbnail_size() To set a custom post thumbnail size.
*
* @since Kleo Framework 1.0
*/
function kleo_setup() {
global $kleo_config;
/*
* Makes theme available for translation.
* Translations can be added to the /languages/ directory.
*/
load_theme_textdomain( 'kleo_framework', get_template_directory() . '/languages' );
/* This theme styles the visual editor with editor-style.css to match the theme style. */
add_editor_style();
/* Adds RSS feed links to
for posts and comments. */
add_theme_support( 'automatic-feed-links' );
/*
* Enable support for Post Formats.
* See http://codex.wordpress.org/Post_Formats
*/
add_theme_support( 'post-formats', array(
'aside',
'image',
'video',
'audio',
'quote',
'link',
'gallery',
) );
/* This theme uses wp_nav_menu() in two locations. */
register_nav_menu( 'primary', __( 'Primary Menu', 'kleo_framework' ) );
register_nav_menu( 'secondary', __( 'Secondary Menu', 'kleo_framework' ) );
register_nav_menu( 'top', __( 'Top Menu', 'kleo_framework' ) );
register_nav_menu( 'side', __( 'Side Menu', 'kleo_framework' ) );
/* This theme uses a custom image size for featured images, displayed on "standard" posts. */
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 672, 9999 ); // Unlimited height, soft crop
$blog_img_single_crop = sq_option( 'blog_img_single_crop', false ) ? true : false;
$blog_img_standard_crop = sq_option( 'blog_img_standard_crop', true ) ? true : false;
$blog_img_grid_crop = sq_option( 'blog_img_grid_crop', false ) ? true : false;
$blog_img_small_crop = sq_option( 'blog_img_small_crop', true ) ? true : false;
//Single post image size
add_image_size( 'kleo-full-width',
sq_option( 'blog_img_single_width', 1038 ),
sq_option( 'blog_img_single_height', 9999 ),
$blog_img_single_crop
); //default 480x270
//check for custom image sizes
if ( sq_option( 'blog_custom_img', 0 ) == 1 ) {
add_image_size( 'kleo-post-gallery',
sq_option( 'blog_img_standard_width', $kleo_config['post_gallery_img_width'] ),
sq_option( 'blog_img_standard_height', $kleo_config['post_gallery_img_height'] ),
$blog_img_standard_crop
); //default 480x270
add_image_size( 'kleo-post-grid',
sq_option( 'blog_img_grid_width', $kleo_config['post_gallery_img_width'] ),
sq_option( 'blog_img_grid_height', 9999 ),
$blog_img_grid_crop
); //default 480xauto-height
add_image_size( 'kleo-post-small-thumb',
sq_option( 'blog_img_small_width', $kleo_config['post_gallery_img_width'] ),
sq_option( 'blog_img_small_height', $kleo_config['post_gallery_img_height'] ),
$blog_img_small_crop
); //default 480xauto-height
}
/*
* 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',
) );
// Add support for featured content.
add_theme_support( 'featured-content', array(
'featured_content_filter' => 'kleo_get_featured_posts',
'max_posts' => 6,
) );
/* Specific framework functionality */
add_theme_support( 'kleo-sidebar-generator' );
add_theme_support( 'kleo-facebook-login' );
add_theme_support( 'kleo-mega-menu' );
add_theme_support( 'kleo-menu-items' );
/* Third-party plugins */
add_theme_support( 'bbpress' );
add_theme_support( 'woocommerce' );
add_theme_support( 'title-tag' );
add_theme_support( 'customize-selective-refresh-widgets' );
}
add_action( 'after_setup_theme', 'kleo_setup' );
if ( ! function_exists( '_wp_render_title_tag' ) ) {
function kleo_slug_render_title() {
?>
= 2 || $page >= 2 ) {
$title = "$title $sep " . sprintf( __( 'Page %s', 'kleo_framework' ), max( $paged, $page ) );
}
return $title;
}
if ( ! function_exists( '_wp_render_title_tag' ) ) {
add_filter( 'wp_title', 'kleo_wp_title', 10, 2 );
}
endif;
/***************************************************
* :: Main menu Navigation
***************************************************/
require_once( KLEO_LIB_DIR . '/menu-walker.php' );
/***************************************************
* :: Featured content
***************************************************/
/**
* Getter function for Featured Content Plugin.
*
* @since Kleo 1.0
*
* @return array An array of WP_Post objects.
*/
function kleo_get_featured_posts() {
/**
* Filter the featured posts to return in Kleo.
*
* @since Kleo 1.0
*
* @param array|bool $posts Array of featured posts, otherwise false.
*/
return apply_filters( 'kleo_get_featured_posts', array() );
}
/**
* A helper conditional function that returns a boolean value.
*
* @since Kleo 1.0
*
* @return bool Whether there are featured posts.
*/
function kleo_has_featured_posts() {
return ! is_paged() && (bool) kleo_get_featured_posts();
}
/*
* Add Featured Content functionality.
*
* To overwrite in a plugin, define your own Featured_Content class on or
* before the 'setup_theme' hook.
*/
if ( ! class_exists( 'Featured_Content' ) && 'plugins.php' !== $GLOBALS['pagenow'] ) {
require get_template_directory() . '/lib/featured-content/featured-content.php';
}
//------------------------------------------------------------------------------
if ( ! function_exists( 'kleo_widgets_init' ) ) :
/**
* Registers our main widget area and the front page widget areas.
*
* @since Kleo 1.0
*/
function kleo_widgets_init() {
register_sidebar( array(
'name' => __( 'Main Sidebar', 'kleo_framework' ),
'id' => 'sidebar-1',
'description' => __( 'Default sidebar', 'kleo_framework' ),
'before_widget' => '
',
'title_reply' => __( 'Leave a reply', 'kleo_framework' ),
'title_reply_to' => __( 'Leave a reply to %s', 'kleo_framework' ),
'cancel_reply_link' => __( 'Click here to cancel the reply', 'kleo_framework' ),
'label_submit' => __( 'Post comment', 'kleo_framework' ),
'comment_field' => '',
'must_log_in' => '
' . sprintf( __( 'You must be logged in to post a comment.', 'kleo_framework' ), wp_login_url( apply_filters( 'the_permalink', get_permalink() ) ) ) . '