tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/**
* Enable support for custom logo.
*
* @since Catch Starter 0.1
*/
add_theme_support( 'custom-logo', array(
'height' => 100,
'width' => 100,
'flex-height' => true,
'flex-width' => true,
) );
// Add support for Block Styles.
add_theme_support( 'wp-block-styles' );
// Add support for editor styles.
add_theme_support( 'editor-styles' );
// Add support for full and wide align images.
add_theme_support( 'align-wide' );
// Add support for responsive embeds.
add_theme_support( 'responsive-embeds' );
// Add custom editor font sizes.
add_theme_support(
'editor-font-sizes',
array(
array(
'name' => __( 'Small', 'catch-starter' ),
'shortName' => __( 'S', 'catch-starter' ),
'size' => 14,
'slug' => 'small',
),
array(
'name' => __( 'Normal', 'catch-starter' ),
'shortName' => __( 'M', 'catch-starter' ),
'size' => 18,
'slug' => 'normal',
),
array(
'name' => __( 'Large', 'catch-starter' ),
'shortName' => __( 'L', 'catch-starter' ),
'size' => 36,
'slug' => 'large',
),
array(
'name' => __( 'Huge', 'catch-starter' ),
'shortName' => __( 'XL', 'catch-starter' ),
'size' => 48,
'slug' => 'huge',
),
)
);
// Add support for custom color scheme.
add_theme_support( 'editor-color-palette', array(
array(
'name' => __( 'White', 'catch-starter' ),
'slug' => 'white',
'color' => '#ffffff',
),
array(
'name' => __( 'Black', 'catch-starter' ),
'slug' => 'black',
'color' => '#000000',
),
array(
'name' => __( 'Medium Black', 'catch-starter' ),
'slug' => 'medium-black',
'color' => '#222222',
),
array(
'name' => __( 'Gray', 'catch-starter' ),
'slug' => 'gray',
'color' => '#f6f6f6',
),
array(
'name' => __( 'Blue', 'catch-starter' ),
'slug' => 'blue',
'color' => '#039be5',
),
) );
/*
* 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' );
// Used in excerpt image Top 16:9 Ratio
set_post_thumbnail_size( 1040, 585, true );
// Used ins Featured Slider 21:9 Ratio
add_image_size( 'catch-starter-slider', 1920, 822, true );
// Used in Portfolio Section , Featured Content, Services 4:3 ratio
add_image_size( 'catch-starter-featured', 666, 500, true );
// Used in Archive image left/right, 1:1 ratio
add_image_size( 'catch-starter-square', 480, 480, true );
// Used in testimonial, 1:1 ratio
add_image_size( 'catch-starter-testimonial', 100, 100, true );
// This theme uses wp_nav_menu() in two locations.
register_nav_menus( array(
'menu-1' => esc_html__( 'Primary Menu', 'catch-starter' ),
'social-header-right' => esc_html__( 'Social Header Right Menu', 'catch-starter' ),
) );
/*
* 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: https://codex.wordpress.org/Post_Formats
*/
add_theme_support( 'post-formats', array(
'aside',
'image',
'video',
'quote',
'link',
'gallery',
'status',
'audio',
'chat',
) );
/*
* This theme styles the visual editor to resemble the theme style,
* specifically font, colors, icons, and column width.
*/
add_editor_style( array( 'assets/css/editor-style.css' ) );
// Indicate widget sidebars can use selective refresh in the Customizer.
add_theme_support( 'customize-selective-refresh-widgets' );
}
endif; // catch_starter_setup
add_action( 'after_setup_theme', 'catch_starter_setup' );
/**
* Sets 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
*
* @since Catch Starter 0.1
*/
function catch_starter_content_width() {
$GLOBALS['content_width'] = apply_filters( 'catch_starter_content_width', 990 );
}
add_action( 'after_setup_theme', 'catch_starter_content_width', 0 );
/**
* Registers a widget area.
*
* @link https://developer.wordpress.org/reference/functions/register_sidebar/
*
* @since Catch Starter 0.1
*/
function catch_starter_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'catch-starter' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here to appear in your sidebar.', 'catch-starter' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 1', 'catch-starter' ),
'id' => 'sidebar-2',
'description' => esc_html__( 'Add widgets here to appear in your footer.', 'catch-starter' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 2', 'catch-starter' ),
'id' => 'sidebar-3',
'description' => esc_html__( 'Add widgets here to appear in your footer.', 'catch-starter' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 3', 'catch-starter' ),
'id' => 'sidebar-4',
'description' => esc_html__( 'Add widgets here to appear in your footer.', 'catch-starter' ),
'before_widget' => '',
'before_title' => '',
) );
//Instagram Widget
if ( class_exists( 'Catch_Instagram_Feed_Gallery_Widget' ) || class_exists( 'Catch_Instagram_Feed_Gallery_Widget_Pro' ) ) {
register_sidebar( array(
'name' => esc_html__( 'Instagram', 'catch-starter' ),
'id' => 'sidebar-instagram',
'description' => esc_html__( 'Appears above footer. This sidebar is only for Widget from plugin Catch Instagram Feed Gallery Widget and Catch Instagram Feed Gallery Widget Pro', 'catch-starter' ),
'before_widget' => '',
'before_title' => '',
) );
}
}
add_action( 'widgets_init', 'catch_starter_widgets_init' );
/**
* Count the number of footer sidebars to enable dynamic classes for the footer
*
* @since Catch Starter 0.1
*/
function catch_starter_footer_sidebar_class() {
$count = 0;
if ( is_active_sidebar( 'sidebar-2' ) ) {
$count++;
}
if ( is_active_sidebar( 'sidebar-3' ) ) {
$count++;
}
if ( is_active_sidebar( 'sidebar-4' ) ) {
$count++;
}
$class = '';
switch ( $count ) {
case '1':
$class = 'one';
break;
case '2':
$class = 'two';
break;
case '3':
$class = 'three';
break;
}
if ( $class )
echo 'class="widget-area footer-widget-area ' . $class . '"'; // WPCS: XSS OK.
}
/**
* Handles JavaScript detection.
*
* Adds a `js` class to the root `` element when JavaScript is detected.
*
* @since Catch Starter 0.1
*/
function catch_starter_javascript_detection() {
echo "\n";
}
add_action( 'wp_head', 'catch_starter_javascript_detection', 0 );
/**
* Enqueues scripts and styles.
*
* @since Catch Starter 0.1
*/
function catch_starter_scripts() {
// Theme stylesheet.
wp_enqueue_style( 'catch-starter-style', get_stylesheet_uri(), null, date( 'Ymd-Gis', filemtime( get_template_directory() . '/style.css' ) ) );
// Theme block stylesheet.
wp_enqueue_style( 'catch-starter-block-style', get_theme_file_uri( '/assets/css/blocks.css' ), array( 'catch-starter-style' ), '1.0' );
// Load the html5 shiv.
wp_enqueue_script( 'catch-starter-html5', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'assets/js/html5.min.js', array(), '3.7.3' );
wp_script_add_data( 'catch-starter-html5', 'conditional', 'lt IE 9' );
wp_enqueue_script( 'catch-starter-skip-link-focus-fix', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'assets/js/skip-link-focus-fix.min.js', array(), '20160816', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && wp_attachment_is_image() ) {
wp_enqueue_script( 'catch-starter-keyboard-image-navigation', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'assets/js/keyboard-image-navigation.min.js', array( 'jquery' ), '20160816' );
}
wp_register_script( 'jquery-match-height', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'assets/js/jquery.matchHeight.min.js', array( 'jquery' ), '20151215', true );
wp_enqueue_script( 'catch-starter-script', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'assets/js/functions.min.js', array( 'jquery', 'jquery-match-height' ), '20160816', true );
wp_localize_script( 'catch-starter-script', 'screenReaderText', array(
'expand' => __( 'expand child menu', 'catch-starter' ),
'collapse' => __( 'collapse child menu', 'catch-starter' ),
'icon' => catch_starter_get_svg( array(
'icon' => 'angle-down',
'fallback' => true,
) ),
) );
//Slider Scripts
$enable_slider = get_theme_mod( 'catch_starter_slider_option', 'disabled' );
$enable_testimonial = get_theme_mod( 'catch_starter_testimonial_option', 'homepage' );
if ( catch_starter_check_section( $enable_slider ) || catch_starter_check_section( $enable_testimonial ) ) {
wp_enqueue_script( 'jquery-cycle2', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'assets/js/jquery.cycle/jquery.cycle2.min.js', array( 'jquery' ), '2.1.5', true );
$transition_effects = array(
get_theme_mod( 'catch_starter_slider_transition_effect', 'fade' ),
);
/**
* Condition checks for additional slider transition plugins
*/
// Scroll Vertical transition plugin addition.
if ( in_array( 'scrollVert', $transition_effects, true ) ) {
wp_enqueue_script( 'jquery-cycle2-scrollVert', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'assets/js/jquery.cycle/jquery.cycle2.scrollVert.min.js', array( 'jquery-cycle2' ), '2.1.5', true );
}
// Flip transition plugin addition.
if ( in_array( 'flipHorz', $transition_effects, true ) || in_array( 'flipVert', $transition_effects, true ) ) {
wp_enqueue_script( 'jquery-cycle2-flip', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'assets/js/jquery.cycle/jquery.cycle2.flip.min.js', array( 'jquery-cycle2' ), '2.1.5', true );
}
// Shuffle transition plugin addition.
if ( in_array( 'tileSlide', $transition_effects, true ) || in_array( 'tileBlind', $transition_effects, true ) ) {
wp_enqueue_script( 'jquery-cycle2-tile', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'assets/js/jquery.cycle/jquery.cycle2.tile.min.js', array( 'jquery-cycle2' ), '2.1.5', true );
}
// Shuffle transition plugin addition.
if ( in_array( 'shuffle', $transition_effects, true ) ) {
wp_enqueue_script( 'jquery-cycle2-shuffle', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'assets/js/jquery.cycle/jquery.cycle2.shuffle.min.js', array( 'jquery-cycle2' ), '2.1.5', true );
}
}
// Enqueue fitvid if JetPack is not installed.
if ( ! class_exists( 'Jetpack' ) ) {
wp_enqueue_script( 'jquery-fitvids', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'assets/js/fitvids.min.js', array( 'jquery' ), '1.1', true );
}
}
add_action( 'wp_enqueue_scripts', 'catch_starter_scripts' );
/**
* Enqueue editor styles for Gutenberg
*
* @since Catch Starter Pro 1.0
*/
function catch_starter_block_editor_styles() {
// Block styles.
wp_enqueue_style( 'catch-starter-block-editor-style', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'assets/css/editor-blocks.css' );
}
add_action( 'enqueue_block_editor_assets', 'catch_starter_block_editor_styles' );
/**
* Custom template tags for this theme.
*/
require get_parent_theme_file_path( 'inc/template-tags.php' );
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer/customizer.php';
/**
* Include Header Background Color Options
*/
require get_parent_theme_file_path( 'inc/header-background-color.php' );
/**
* SVG icons functions and filters.
*/
require get_parent_theme_file_path( 'inc/icon-functions.php' );
/**
* Custom functions that act independently of the theme templates.
*/
require get_parent_theme_file_path( 'inc/extras.php' );
/**
* Add functions for header media.
*/
require get_parent_theme_file_path( 'inc/custom-header.php' );
/**
* Load Jetpack compatibility file.
*/
require get_parent_theme_file_path( 'inc/jetpack.php' );
/**
* Include Breadcrumb
*/
require get_parent_theme_file_path( '/inc/breadcrumb.php' );
/**
* Include Slider
*/
require get_parent_theme_file_path( '/inc/featured-slider.php' );
/**
* Include Service
*/
require get_parent_theme_file_path( '/inc/service.php' );
/**
* Add Metaboxes
*/
require get_parent_theme_file_path( 'inc/metabox/metabox.php' );
/**
* Modifies tag cloud widget arguments to have all tags in the widget same font size.
*
* @since Catch Starter 0.1
*
* @param array $args Arguments for tag cloud widget.
* @return array A new modified arguments.
*/
function catch_starter_widget_tag_cloud_args( $args ) {
$args['largest'] = 1;
$args['smallest'] = 1;
$args['unit'] = 'em';
return $args;
}
add_filter( 'widget_tag_cloud_args', 'catch_starter_widget_tag_cloud_args' );
/**
* Load TGMPA
*/
require get_template_directory() . '/inc/class-tgm-plugin-activation.php';
/**
* Register the required plugins for this theme.
*
* In this example, we register five plugins:
* - one included with the TGMPA library
* - two from an external source, one from an arbitrary source, one from a GitHub repository
* - two from the .org repo, where one demonstrates the use of the `is_callable` argument
*
* The variables passed to the `tgmpa()` function should be:
* - an array of plugin arrays;
* - optionally a configuration array.
* If you are not changing anything in the configuration array, you can remove the array and remove the
* variable from the function call: `tgmpa( $plugins );`.
* In that case, the TGMPA default settings will be used.
*
* This function is hooked into `tgmpa_register`, which is fired on the WP `init` action on priority 10.
*/
function catch_starter_register_required_plugins() {
/*
* Array of plugin arrays. Required keys are name and slug.
* If the source is NOT from the .org repo, then source is also required.
*/
$plugins = array(
// Catch Web Tools.
array(
'name' => 'Catch Web Tools', // Plugin Name, translation not required.
'slug' => 'catch-web-tools',
),
// Catch IDs
array(
'name' => 'Catch IDs', // Plugin Name, translation not required.
'slug' => 'catch-ids',
),
// To Top.
array(
'name' => 'To top', // Plugin Name, translation not required.
'slug' => 'to-top',
),
// Catch Gallery.
array(
'name' => 'Catch Gallery', // Plugin Name, translation not required.
'slug' => 'catch-gallery',
),
);
if ( ! class_exists( 'Catch_Infinite_Scroll_Pro' ) ) {
$plugins[] = array(
'name' => 'Catch Infinite Scroll', // Plugin Name, translation not required.
'slug' => 'catch-infinite-scroll',
);
}
if ( ! class_exists( 'Essential_Content_Types_Pro' ) ) {
$plugins[] = array(
'name' => 'Essential Content Types', // Plugin Name, translation not required.
'slug' => 'essential-content-types',
);
}
if ( ! class_exists( 'Essential_Widgets_Pro' ) ) {
$plugins[] = array(
'name' => 'Essential Widgets', // Plugin Name, translation not required.
'slug' => 'essential-widgets',
);
}
if ( ! class_exists( 'Catch_Instagram_Feed_Gallery_Widget_Pro' ) ) {
$plugins[] = array(
'name' => 'Catch Instagram Feed Gallery & Widget', // Plugin Name, translation not required.
'slug' => 'catch-instagram-feed-gallery-widget',
);
}
/*
* Array of configuration settings. Amend each line as needed.
*
* TGMPA will start providing localized text strings soon. If you already have translations of our standard
* strings available, please help us make TGMPA even better by giving us access to these translations or by
* sending in a pull-request with .po file(s) with the translations.
*
* Only uncomment the strings in the config array if you want to customize the strings.
*/
$config = array(
'id' => 'catch-starter', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to bundled plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'has_notices' => true, // Show admin notices or not.
'dismissable' => true, // If false, a user cannot dismiss the nag message.
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
);
tgmpa( $plugins, $config );
}
add_action( 'tgmpa_register', 'catch_starter_register_required_plugins' );