tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 640, 480, true ); // Ratio 3:2 // Used in portfolio add_image_size( 'adonis-portfolio', 640, 480 ); // Ratio 3:2 // Used in Services add_image_size( 'adonis-services', 100, 100 ); // Variable width, height fixed // Used in hero content add_image_size( 'adonis-hero', 592, 592, true ); // Ratio 1:1 // Used in featured content add_image_size( 'adonis-featured', 640, 480, true ); // Ratio 3:2 // Used in featured slider add_image_size( 'adonis-slider', 1920, 954, true ); // Used in testimonials add_image_size( 'adonis-testimonial', 240, 240, true ); // Ratio 1:1 // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'menu-1' => esc_html__( 'Primary', 'adonis' ), 'social-menu' => esc_html__( 'Social Menu', 'adonis' ), ) ); /* * 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', ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /** * Add support for core custom logo. * * @link https://codex.wordpress.org/Theme_Logo */ add_theme_support( 'custom-logo', array( 'height' => 225, 'width' => 225, 'flex-height' => true, 'flex-width' => true, ) ); // Add support for Block Styles. add_theme_support( 'wp-block-styles' ); // Add support for full and wide align images. add_theme_support( 'align-wide' ); // Add support for editor styles. add_theme_support( 'editor-styles' ); // 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', 'adonis' ), 'shortName' => __( 'S', 'adonis' ), 'size' => 13, 'slug' => 'small', ), array( 'name' => __( 'Normal', 'adonis' ), 'shortName' => __( 'M', 'adonis' ), 'size' => 16, 'slug' => 'normal', ), array( 'name' => __( 'Large', 'adonis' ), 'shortName' => __( 'L', 'adonis' ), 'size' => 28, 'slug' => 'large', ), array( 'name' => __( 'Huge', 'adonis' ), 'shortName' => __( 'XL', 'adonis' ), 'size' => 38, 'slug' => 'huge', ), ) ); // Add support for custom color scheme. add_theme_support( 'editor-color-palette', array( array( 'name' => __( 'White', 'adonis' ), 'slug' => 'white', 'color' => '#ffffff', ), array( 'name' => __( 'Black', 'adonis' ), 'slug' => 'black', 'color' => '#000000', ), array( 'name' => __( 'Dark Gray', 'adonis' ), 'slug' => 'dark-gray', 'color' => '#333333', ), array( 'name' => __( 'Medium Gray', 'adonis' ), 'slug' => 'medium-gray', 'color' => '#e5e5e5', ), array( 'name' => __( 'Light Gray', 'adonis' ), 'slug' => 'light-gray', 'color' => '#f7f7f7', ), array( 'name' => __( 'Blue', 'adonis' ), 'slug' => 'blue', 'color' => '#1982c4', ), ) ); add_editor_style( array( 'assets/css/editor-style.css', adonis_fonts_url() ) ); } endif; add_action( 'after_setup_theme', 'adonis_setup' ); /** * Count the number of footer sidebars to enable dynamic classes for the footer * */ function adonis_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++; } if ( is_active_sidebar( 'sidebar-5' ) ) { $count++; } $class = ''; switch ( $count ) { case '1': $class = 'one'; break; case '2': $class = 'two'; break; case '3': $class = 'three'; break; case '4': $class = 'four'; break; } if ( $class ) { echo 'class="widget-area footer-widget-area ' . esc_attr( $class ) . '"'; } } /** * 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 adonis_content_width() { $GLOBALS['content_width'] = apply_filters( 'adonis_content_width', 920 ); } add_action( 'after_setup_theme', 'adonis_content_width', 0 ); if ( ! function_exists( 'adonis_template_redirect' ) ) : /** * Set the content width in pixels, based on the theme's design and stylesheet for different value other than the default one * * @global int $content_width */ function adonis_template_redirect() { $layout = adonis_get_theme_layout(); if ( 'no-sidebar-full-width' === $layout ) { $GLOBALS['content_width'] = 1640; } } endif; add_action( 'template_redirect', 'adonis_template_redirect' ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function adonis_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'adonis' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'adonis' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer 1', 'adonis' ), 'id' => 'sidebar-2', 'description' => esc_html__( 'Add widgets here to appear in your footer.', 'adonis' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer 2', 'adonis' ), 'id' => 'sidebar-3', 'description' => esc_html__( 'Add widgets here to appear in your footer.', 'adonis' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer 3', 'adonis' ), 'id' => 'sidebar-4', 'description' => esc_html__( 'Add widgets here to appear in your footer.', 'adonis' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'adonis_widgets_init' ); if ( ! function_exists( 'adonis_fonts_url' ) ) : /** * Register Google fonts for Adonis Pro * * Create your own adonis_fonts_url() function to override in a child theme. * * @since Adonis 0.1 * * @return string Google fonts URL for the theme. */ function adonis_fonts_url() { $fonts_url = ''; /* Translators: If there are characters in your language that are not * supported by Montserrat, translate this to 'off'. Do not translate * into your own language. */ $open_sans = _x( 'on', 'Open Sans: on or off', 'adonis' ); /* Translators: If there are characters in your language that are not * supported by Playfair Display, translate this to 'off'. Do not translate * into your own language. */ $source_sans = _x( 'on', 'Source Sans Pro font: on or off', 'adonis' ); if ( 'off' !== $open_sans || 'off' !== $source_sans ) { $font_families = array(); if ( 'off' !== $open_sans ) { $font_families[] = 'Open Sans:300,400,600,700,900,300italic,400italic,600italic,700italic,900italic'; } if ( 'off' !== $source_sans ) { $font_families[] = 'Source Sans Pro:300,400,600,700,900,300italic,400italic,600italic,700italic,900italic'; } $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), ); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); } return esc_url_raw( $fonts_url ); } endif; if ( ! function_exists( 'adonis_excerpt_length' ) ) : /** * Sets the post excerpt length to n words. * * function tied to the excerpt_length filter hook. * @uses filter excerpt_length * * @since Simple Persona Pro 1.0 */ function adonis_excerpt_length( $length ) { if ( is_admin() ) { return $length; } // Getting data from Customizer Options $length = get_theme_mod( 'adonis_excerpt_length', 30 ); return absint( $length ); } endif; //simple_persona_excerpt_length add_filter( 'excerpt_length', 'adonis_excerpt_length', 999 ); /** * Handles JavaScript detection. * * Adds a `js` class to the root `` element when JavaScript is detected. * * @since Adonis 0.1 */ function adonis_javascript_detection() { echo "\n"; } add_action( 'wp_head', 'adonis_javascript_detection', 0 ); /** * Enqueue scripts and styles. */ function adonis_scripts() { wp_enqueue_style( 'adonis-fonts', adonis_fonts_url(), array(), null ); wp_enqueue_style( 'adonis-style', get_stylesheet_uri() ); // Theme block stylesheet. wp_enqueue_style( 'adonis-block-style', get_theme_file_uri( '/assets/css/blocks.css' ), array( 'adonis-style' ), '1.0' ); wp_enqueue_script( 'adonis-skip-link-focus-fix', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'assets/js/skip-link-focus-fix.min.js', array(), '20180111', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script( 'adonis-script', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'assets/js/functions.min.js', array( 'jquery' ), '20180111', true ); wp_localize_script( 'adonis-script', 'adonisScreenReaderText', array( 'expand' => esc_html__( 'expand child menu', 'adonis' ), 'collapse' => esc_html__( 'collapse child menu', 'adonis' ), 'icon' => adonis_get_svg( array( 'icon' => 'caret-down', 'fallback' => true ) ), ) ); //Slider Scripts $enable_slider = get_theme_mod( 'adonis_slider_option', 'disabled' ); $enable_testimonial = get_theme_mod( 'adonis_testimonial_option', 'homepage' ); $enable_logo = get_theme_mod( 'adonis_logo_option', 'homepage' ); if ( adonis_check_section( $enable_slider ) || adonis_check_section( $enable_testimonial ) || adonis_check_section( $enable_logo ) ) { 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( 'adonis_slider_transition_effects', '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 ); } // Carousel transition plugin addition. if ( adonis_check_section( $enable_logo ) ) { wp_enqueue_script( 'jquery-cycle2-carousel', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'assets/js/jquery.cycle/jquery.cycle2.carousel.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', 'adonis_scripts' ); /**d * Enqueue editor styles for Gutenberg */ function adonis_block_editor_styles() { // Block styles. wp_enqueue_style( 'adonis-block-editor-style', trailingslashit( esc_url ( get_template_directory_uri() ) ) . 'assets/css/editor-blocks.css' ); // Add custom fonts. wp_enqueue_style( 'adonis-fonts', adonis_fonts_url(), array(), null ); } add_action( 'enqueue_block_editor_assets', 'adonis_block_editor_styles' ); /** * SVG icons functions and filters. */ require get_parent_theme_file_path( '/inc/icon-functions.php' ); /** * Implement the Custom Header feature. */ require get_template_directory() . '/inc/custom-header.php'; /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Functions which enhance the theme by hooking into WordPress. */ require get_template_directory() . '/inc/template-functions.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer/customizer.php'; /** * Load Jetpack compatibility file. */ if ( defined( 'JETPACK__VERSION' ) ) { require get_template_directory() . '/inc/jetpack.php'; } /** * Color Scheme additions */ require get_template_directory() . '/inc/header-background-color.php'; /** * Include Breadcrumbs */ require get_template_directory() . '/inc/breadcrumb.php'; /** * Include Slider */ require get_template_directory() . '/inc/featured-slider.php'; /** * Load Metabox */ require get_template_directory() . '/inc/metabox/metabox.php'; /** * Load Social Widgets */ require get_template_directory() . '/inc/widget-social-icons.php'; /** * Load TGMPA */ require get_template_directory() . '/inc/class-tgm-plugin-activation.php'; /** * Load JSON_LD Breadcrumb file. */ require trailingslashit( get_template_directory() ) . 'inc/json-ld-schema.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 adonis_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' => 'adonis', // 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', 'adonis_register_required_plugins' );