'f8f6f2'
) );
/* Add support for Custom Logo
==================================== */
add_theme_support( 'custom-logo', array(
'height' => 100,
'width' => 300,
'flex-width' => true,
'flex-height' => true,
) );
/* Add support for post and comment RSS feed links in
==================================== */
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'customize-selective-refresh-widgets' );
/*
* 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' );
/* Add support for Localization
==================================== */
load_theme_textdomain( 'endurance', get_template_directory() . '/languages' );
$locale = get_locale();
$locale_file = get_template_directory() . "/languages/$locale.php";
if ( is_readable($locale_file) )
require_once($locale_file);
/* Add support for Custom Headers
==================================== */
add_theme_support(
'custom-header', apply_filters(
'academia_custom_header_args', array(
'width' => 980,
'height' => 450,
'flex-height' => true,
'video' => false
)
)
);
add_theme_support( 'responsive-embeds' );
// Register nav menus
register_nav_menus( array(
'primary' => __( 'Main Menu', 'endurance' ),
'mobile' => __( 'Mobile Menu', 'endurance' )
) );
}
endif;
add_action( 'after_setup_theme', 'endurance_setup' );
add_filter( 'image_size_names_choose', 'endurance_custom_sizes' );
function endurance_custom_sizes( $sizes ) {
return array_merge( $sizes, array(
'endurance-thumb-slideshow' => __( 'Featured Image: Slideshow Size', 'endurance' ),
'endurance-thumb-featured-page' => __( 'Featured Image: Page Thumbnail', 'endurance' ),
'post-thumbnail' => __( 'Featured Image: Thumbnail', 'endurance' ),
) );
}
if ( ! function_exists( 'endurance_fonts_url' ) ) :
/**
* Register Google fonts for Endurance
*
* Create your own endurance_fonts_url() function to override in a child theme.
*
* @since Endurance 1.0
*
* @return string Google fonts URL for the theme.
*/
function endurance_fonts_url() {
$fonts_url = '';
$subsets = 'latin,latin-ext';
/* translators: If there are characters in your language that are not supported by Noto Sans, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Noto Sans font: on or off', 'endurance' ) ) {
$fonts[] = 'Noto Sans:400,400i,700,700i';
}
/* 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. */
if ( 'off' !== _x( 'on', 'Montserrat font: on or off', 'endurance' ) ) {
$fonts[] = 'Montserrat:400,700';
}
if ( $fonts ) {
$fonts_url = add_query_arg( array(
'family' => rawurlencode( implode( '|', $fonts ) ),
'subset' => rawurlencode( $subsets ),
), '//fonts.googleapis.com/css' );
}
return $fonts_url;
}
endif;
if ( ! function_exists( 'endurance_js_scripts' ) ) :
/* Add javascripts and CSS used by the theme
================================== */
function endurance_js_scripts() {
$theme_version = wp_get_theme()->get( 'Version' );
// Theme stylesheet.
wp_enqueue_style( 'endurance-style', get_stylesheet_uri(), array(), $theme_version );
if (! is_admin()) {
wp_enqueue_script(
'jquery-superfish',
get_template_directory_uri() . '/js/superfish.min.js',
array('jquery'),
true
);
wp_enqueue_script(
'jquery-flexslider',
get_template_directory_uri() . '/js/jquery.flexslider-min.js',
array('jquery'),
true
);
wp_register_script( 'endurance-scripts', get_template_directory_uri() . '/js/endurance.js', array( 'jquery' ), $theme_version, true );
wp_enqueue_script( 'endurance-scripts' );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
/* Font-Awesome */
wp_enqueue_style('font-awesome', get_template_directory_uri() . '/css/fontawesome.all.min.css', null, '5.15.3');
// Loads our default Google Webfont
wp_enqueue_style( 'endurance-webfonts', endurance_fonts_url(), array(), null, null );
}
}
endif;
add_action('wp_enqueue_scripts', 'endurance_js_scripts');
if ( ! function_exists( 'endurance_get_the_archive_title' ) ) :
/* Custom Archives titles.
=================================== */
function endurance_get_the_archive_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( '', false );
}
return $title;
}
endif;
add_filter( 'get_the_archive_title', 'endurance_get_the_archive_title' );
/* Enable Excerpts for Static Pages
==================================== */
add_action( 'init', 'endurance_excerpts_for_pages' );
if ( ! function_exists( 'endurance_excerpts_for_pages' ) ) :
function endurance_excerpts_for_pages() {
add_post_type_support( 'page', 'excerpt' );
}
endif;
/* Custom Excerpt Length
==================================== */
if ( ! function_exists( 'endurance_new_excerpt_length' ) ) :
function endurance_new_excerpt_length($length) {
if ( is_admin() ) { return $length; }
else { return 30; }
}
endif;
add_filter('excerpt_length', 'endurance_new_excerpt_length');
if ( ! function_exists( 'endurance_excerpts' ) ) :
/* Replace invalid ellipsis from excerpts
==================================== */
function endurance_excerpts($text)
{
if ( is_admin() ) return $text;
$text = str_replace(' […]', '…', $text);
$text = str_replace('[…]', '…', $text);
$text = str_replace('[...]', '...', $text);
return $text;
}
endif;
add_filter('excerpt_more', 'endurance_excerpts');
if ( ! function_exists( 'endurance_hex2rgb' ) ) :
/* Convert HEX color to RGB value (for the customizer)
==================================== */
function endurance_hex2rgb($hex) {
$hex = str_replace("#", "", $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
$b = hexdec(substr($hex,4,2));
}
$rgb = "$r, $g, $b";
return $rgb; // returns an array with the rgb values
}
endif;
if ( ! function_exists( 'endurance_pingback_header' ) ) :
/**
* Add a pingback url auto-discovery header for singularly identifiable articles.
*/
function endurance_pingback_header() {
if ( is_singular() && pings_open() ) {
printf( '' . "\n", esc_url(get_bloginfo( 'pingback_url' )) );
}
}
endif;
add_action( 'wp_head', 'endurance_pingback_header' );
if ( ! function_exists( 'endurance_theme_support_classic_widgets' ) ) :
function endurance_theme_support_classic_widgets() {
remove_theme_support( 'widgets-block-editor' );
}
endif;
add_action( 'after_setup_theme', 'endurance_theme_support_classic_widgets' );
/**
* --------------------------------------------
* Enqueue scripts and styles for the backend.
*
* @package Endurance
* --------------------------------------------
*/
if ( ! function_exists( 'endurance_scripts_admin' ) ) {
/**
* Enqueue admin styles and scripts
*
* @since 1.0.0
* @return void
*/
function endurance_scripts_admin( $hook ) {
// if ( 'widgets.php' !== $hook ) return;
// Styles
wp_enqueue_style(
'endurance-style-admin',
get_template_directory_uri() . '/ilovewp-admin/css/ilovewp_theme_settings.css',
'', ILOVEWP_VERSION, 'all'
);
}
}
add_action( 'admin_enqueue_scripts', 'endurance_scripts_admin' );
if ( ! function_exists( 'endurance_body_classes' ) ) :
/**
* Adds custom classes to the array of body classes.
*
* @since Endurance 1.0
*
* @param array $classes Classes for the body element.
* @return array (Maybe) filtered body classes.
*/
function endurance_body_classes( $classes ) {
$classes[] = ilovewp_helper_get_header_style();
return $classes;
}
endif;
add_filter( 'body_class', 'endurance_body_classes' );
if ( ! function_exists( 'endurance_the_custom_logo' ) ) {
/**
* Displays the optional custom logo.
*
* Does nothing if the custom logo is not available.
*
* @since Endurance 1.0
*/
function endurance_the_custom_logo() {
if ( function_exists( 'the_custom_logo' ) ) {
// We don't use the default the_custom_logo() function because of its automatic addition of itemprop attributes (they fail the ARIA tests)
$site = get_bloginfo('name');
$custom_logo_id = get_theme_mod( 'custom_logo' );
if ( $custom_logo_id ) {
$html = sprintf( '%2$s',
esc_url( home_url( '/' ) ),
wp_get_attachment_image( $custom_logo_id, 'full', false, array(
'class' => 'custom-logo',
'alt' => __('Logo for ','endurance') . esc_attr($site),
) )
);
}
echo $html;
}
}
}
if ( ! function_exists( 'endurance_comment' ) ) :
/**
* Template for comments and pingbacks.
* Used as a callback by wp_list_comments() for displaying the comments.
*/
function endurance_comment( $comment, $args, $depth ) {
if ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) : ?>