* @copyright Copyright (c) 2018, Radiuzz
* @link http://caelum.radiuzz.com
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 or later
*/
define( 'CAELUM_VERSION', '1.0' );
if ( ! isset( $content_width ) ) {
$content_width = 1080;
}
if ( ! function_exists( 'caelum_setup' ) ) :
/**
* caelum setup
*/
function caelum_setup() {
load_theme_textdomain( 'caelum', get_template_directory() . '/languages' );
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
/**
* Register Menus
*/
register_nav_menus( array(
'main-menu' => esc_html__( 'Main Menu', 'caelum' ),
'side-menu' => esc_html__( 'Side Menu', 'caelum' )
) );
/**
* Add post type
*/
add_theme_support( 'post-formats', array( 'gallery', 'video', 'audio', 'link' ) );
/**
* Add post thumbnail support
*/
add_theme_support( 'post-thumbnails' );
/**
* Add image size
*/
add_image_size( 'caelum_full_thumb', 750, 9999 ); // Slider post format.
add_image_size( 'caelum_base_thumb', 1080, 720, true ); // Slider post format.
add_image_size( 'caelum_medium_thumb', 855, 720, true ); // Standard Post
add_image_size( 'caelum_related_thumb', 285, 240, true ); // Grid post featured.
add_image_size( 'caelum_small_thumb', 80, 65, true ); // Widget post format.
/**
* Add feed links
*/
add_theme_support( 'automatic-feed-links' );
/**
* Add title tag
*/
add_theme_support( 'title-tag' );
/*
* Add Editor Style
*/
add_editor_style( array( 'css/editor-style.css', caelum_fonts_url() ) );
}
endif;
add_action( 'after_setup_theme', 'caelum_setup' );
/**
* Register Google Fonts
*
* @since 1.0.5
*/
if ( ! function_exists( 'caelum_fonts_url' ) ) :
function caelum_fonts_url() {
$fonts_url = '';
$fonts = array();
$subsets = 'latin,latin-ext';
/* transCrimson Textrs: If there are characters in your language that are not supported by Crimson Text, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Crimson Text font: on or off', 'caelum' ) ) {
$fonts[] = 'Crimson Text:400,100,100italic,300italic,300,400italic,700,700italic,900italic,900';
}
/* transCrimson Textrs: If there are characters in your language that are not supported by dosis, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'dosis font: on or off', 'caelum' ) ) {
$fonts[] = 'dosis:400,400i,700,700i';
}
if ( $fonts ) {
$fonts_url = add_query_arg( array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
), 'https://fonts.googleapis.com/css' );
}
return $fonts_url;
}
endif;
/**
* Register Sidebars
*
* @since 1.0
*/
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'name' => esc_html__( 'Sidebar', 'caelum' ),
'id' => 'main_sidebar',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
));
register_sidebar(array(
'name' => esc_html__( 'Instagram Footer', 'caelum' ),
'id' => 'instagram_widget',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'description' => esc_html__( 'Use the "Instagram" widget here. IMPORTANT: For best result set number of photos to 6.', 'caelum' ),
));
}
if ( ! function_exists( 'caelum_load_scripts' ) ) :
/**
* Register and enqueue styles/scripts
*/
function caelum_load_scripts() {
/**
* Load Fonts
*/
wp_enqueue_style( 'caelum-fonts', caelum_fonts_url(), array(), null );
/**
* Load styles
*/
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), CAELUM_VERSION );
wp_enqueue_style( 'icons', get_template_directory_uri() . '/css/icons.css', array(), CAELUM_VERSION );
wp_enqueue_style( 'caelum-style', get_template_directory_uri() . '/style.css', array(), CAELUM_VERSION );
/**
* Load scripts
*/
wp_enqueue_script( 'enscroll-script', get_template_directory_uri() . '/js/enscroll-0.5.2.min.js', array(), CAELUM_VERSION, true );
wp_enqueue_script( 'owl-carousel-script', get_template_directory_uri() . '/js/owl.carousel.min.js', array(), CAELUM_VERSION, true );
wp_enqueue_script( 'sticky-kit-script', get_template_directory_uri() . '/js/jquery.sticky-kit.js', array(), CAELUM_VERSION, true );
wp_enqueue_script( 'fitvids-script', get_template_directory_uri() . '/js/jquery.fitvids.js', array(), CAELUM_VERSION, true );
wp_enqueue_script( 'caelum-script', get_template_directory_uri() . '/js/main.js', array('jquery'), CAELUM_VERSION, true );
if ( is_singular() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
wp_enqueue_script('masonry');
}
endif;
add_action( 'wp_enqueue_scripts', 'caelum_load_scripts' );
include get_template_directory() . '/inc/tgm-init.php';
include get_template_directory() . '/inc/theme_options.php';
include get_template_directory() . '/inc/metabox/post_metabox.php';
include get_template_directory() . '/inc/metabox/format_metabox.php';
include get_template_directory() . '/inc/theme-filters.php';
include get_template_directory() . '/inc/aq_resizer.php';
include get_template_directory() . '/inc/widgets/widget_social_icons.php';
include get_template_directory() . '/inc/widgets/widget_popular_posts.php';
/**
* Display Menu
* @link https://codex.wordpress.org/Navigation_Menus
* @since 1.0
*
*/
if( !function_exists('caelum_menu')) {
function caelum_menu($class = '') {
if ( function_exists('wp_nav_menu') && has_nav_menu( 'main-menu' ) ) {
wp_nav_menu(array(
'container' => false,
'menu_class' => $class,
'menu_id' => '',
'theme_location' => 'main-menu',
));
} else {
echo '';
}
}
}
/**
* The Excerpt
*
* @since 1.0
*/
function caelum_custom_excerpt_length( $length ) {
return 200;
}
add_filter( 'excerpt_length', 'caelum_custom_excerpt_length', 999 );
function caelum_string_limit_words($string, $word_limit) {
$words = explode(' ', $string, ($word_limit + 1));
if(count($words) > $word_limit) {
array_pop($words);
}
return implode(' ', $words);
}
/**
* Restyle Categories Widget
*
* @since 1.0
*/
function caelum_cat_count_inline($links) {
$links = str_replace(' (', '', $links);
$links = str_replace(')', '', $links);
return $links;
}
add_filter('wp_list_categories', 'caelum_cat_count_inline');
/**
* Modifies tag cloud widget arguments to have all tags in the widget same font size.
*
* @param array $args Arguments for tag cloud widget.
* @return array A new modified arguments.
*/
function caelum_custom_tag_cloud_widget($args) {
$args['largest'] = 10; //largest tag
$args['smallest'] = 10; //smallest tag
$args['unit'] = 'px'; //tag font unit
return $args;
}
add_filter( 'widget_tag_cloud_args', 'caelum_custom_tag_cloud_widget' );
/**
* Pagination
*
* @since 1.0
*/
function caelum_pagination() { ?>
id="comment-">
a, .post-tags a, .comment-reply a, .coloured-title, .logged-in-as a.log-out, blockquote.style2:before, blockquote.style2 span, .scroll-up a:hover, .scroll-up a:active {color: {$accent_color}}.cat:before, .cat:after, .btn, .widget_mc4wp_form_widget form input[type=submit]:hover, .page-title:before, .backtohome:hover, .wpcf7 .wpcf7-submit:hover,.comment-form button:hover {background-color: {$accent_color}}.post-content blockquote p, .scroll-up a:hover, .scroll-up a:active {border-color:{$accent_color}}.caelum-footer {background-color:{$footer_bg_color}}header .logo{padding-top:{$header_padding_top}px;padding-bottom:{$header_padding_bottom}px}";
wp_add_inline_style( 'caelum-custom-style', $custom_css );
}
add_action( 'wp_enqueue_scripts', 'caelum_custom_styles' );