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', array( 'post', 'page', 'product' ) );
add_image_size( 'belise-hero-image', 1920, 615, true );
add_image_size( 'belise-post-image', 370, 270, true );
add_image_size( 'belise-jetpack-portfolio-thumbnail', 500, 500, true );
add_image_size( 'belise-jetpack-testimonial-thumbnail', 370, 270, true );
// Added WooCommerce support
add_theme_support( 'woocommerce' );
// WooCommerce support for latest gallery
if ( class_exists( 'WooCommerce' ) ) {
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}
// This theme uses wp_nav_menu() in one location.
register_nav_menus(
array(
'primary' => esc_html__( 'Primary', 'belise-lite' ),
'categories' => esc_html__( 'Categories', 'belise-lite' ),
'social-icons' => esc_html__( 'Social Icons', 'belise-lite' ),
'shop' => esc_html__( 'Shop', 'belise-lite' ),
)
);
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support(
'html5', array(
'gallery',
'caption',
)
);
// Set up the WordPress core custom background feature.
add_theme_support(
'custom-background', apply_filters(
'belise_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
)
)
);
// Add theme support for custom logo
add_theme_support(
'custom-logo', array(
'height' => 90,
'width' => 300,
'flex-width' => true,
)
);
// Add theme support for Jetpack food menus
add_theme_support( 'nova_menu_item' );
// Selective refresh for widgets
add_theme_support( 'customize-selective-refresh-widgets' );
}
endif;
add_action( 'after_setup_theme', 'belise_setup' );
if ( ! function_exists( 'belise_starter_content' ) ) :
/**
* Starter Content support and items.
*/
function belise_starter_content() {
$about_page_content = '
[testimonials columns="3"]
';
/*
* Starter Content Support
*/
add_theme_support(
'starter-content', array(
'posts' => array(
'home',
'about' => array(
'post_content' => wp_kses_post( $about_page_content ),
'template' => 'template-full-width.php',
),
'contact' => array(
'template' => 'template-full-width.php',
),
'blog',
'events' => array(
'post_type' => 'page',
'template' => 'template-main-events.php',
'post_title' => esc_html__( 'Events', 'belise-lite' ),
'post_content' => esc_html__( 'About Services', 'belise-lite' ),
),
),
'nav_menus' => array(
'primary' => array(
'name' => esc_html__( 'Primary Menu', 'belise-lite' ),
'items' => array(
'page_home',
'page_blog',
'page_events' => array(
'type' => 'post_type',
'object' => 'page',
'object_id' => '{{events}}',
),
'page_contact',
'page_about',
),
),
'social-icons' => array(
'name' => esc_html__( 'Social Links Menu', 'belise-lite' ),
'items' => array(
'link_facebook',
'link_pinterest',
'link_twitter',
'link_instagram',
),
),
),
'options' => array(
'show_on_front' => 'page',
'page_on_front' => '{{home}}',
'page_for_posts' => '{{blog}}',
),
'widgets' => array(
'ribbon_area' => array(
'belise_ribbon_widget_content' => array(
'belise_ribbon-widget',
array(
'title' => esc_html__( 'You can edit this ribbon under ', 'belise-lite' ),
'text' => esc_html__( 'Widgets in the Ribbon Area', 'belise-lite' ),
'button_text' => 'button',
'button_link' => '#',
'image_uri' => get_template_directory_uri() . '/img/hero-image.jpg',
'image_in_customizer' => get_template_directory_uri() . '/img/hero-image.jpg',
),
),
),
),
)
);
}
endif;
add_action( 'after_setup_theme', 'belise_starter_content' );
/**
* 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 belise_content_width() {
$GLOBALS['content_width'] = apply_filters( 'belise_content_width', 640 );
}
add_action( 'after_setup_theme', 'belise_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function belise_widgets_init() {
register_sidebar(
array(
'name' => esc_html__( 'Sidebar', 'belise-lite' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Main sidebar widgets.', 'belise-lite' ),
'before_widget' => '
',
'before_title' => '
',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer 1', 'belise-lite' ),
'id' => 'footer_widget_col_1',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer 2', 'belise-lite' ),
'id' => 'footer_widget_col_2',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer 3', 'belise-lite' ),
'id' => 'footer_widget_col_3',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Events section', 'belise-lite' ),
'id' => 'events_area',
'description' => esc_html__( 'Add widgets here to display them on FrontPage within Events Section', 'belise-lite' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
)
);
}
add_action( 'widgets_init', 'belise_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function belise_scripts() {
wp_enqueue_style( 'belise-style', get_stylesheet_uri(), array( 'boostrap' ), BELISE_VERSION );
wp_enqueue_style( 'boostrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), 'v3.3.7', 'all' );
wp_enqueue_style( 'belise-woocommerce-style', get_template_directory_uri() . '/inc/woocommerce/css/woocommerce.css', array(), 'v1.0.12' );
wp_enqueue_style( 'belise-fonts', belise_fonts_url(), array(), null );
wp_enqueue_script( 'skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', array(), 'v4.7.0' );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
wp_enqueue_script( 'comments-js', get_template_directory_uri() . '/js/comments.js', array( 'jquery' ), 'v1', true );
}
if ( is_category() || is_search() || is_archive() || is_home() ) {
wp_enqueue_script( 'belise-masonry-call', get_template_directory_uri() . '/js/masonry-call.js', array( 'masonry' ), '20120206', true );
}
wp_enqueue_script( 'belise-functions', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20120206', true );
}
add_action( 'wp_enqueue_scripts', 'belise_scripts' );
/**
* Belise fonts url
*
* @return string
*/
function belise_fonts_url() {
$fonts_url = '';
/*
* Translators: If there are characters in your language that are not
* supported by Works Sans / Lora, translate this to 'off'. Do not translate
* into your own language.
*/
$work_sans = _x( 'on', 'Work Sans font: on or off', 'belise-lite' );
$lora = _x( 'on', 'Lora font: on or off', 'belise-lite' );
if ( 'off' !== $work_sans || 'off' !== $lora ) {
$font_families = array();
if ( 'off' !== $work_sans ) {
$font_families[] = 'Work Sans:500,600,700,800,900';
}
if ( 'off' !== $lora ) {
$font_families[] = 'Lora:300,400';
}
$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 $fonts_url;
}
/**
* Implement the Custom Header feature.
*/
require BELISE_PHP_INCLUDE . '/custom-header.php';
/**
* Custom template tags for this theme.
*/
require BELISE_PHP_INCLUDE . '/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require BELISE_PHP_INCLUDE . '/extras.php';
/**
* Customizer additions.
*/
require BELISE_PHP_INCLUDE . '/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require BELISE_PHP_INCLUDE . '/jetpack.php';
/**
* TGM plugin activation.
*/
require_once BELISE_PHP_INCLUDE . '/class-tgm-plugin-activation.php';
/**
* Define Allowed Files to be included.
*/
function belise_filter_features( $array ) {
return array_merge(
$array, array(
'/customizer/customizer-pro/customizer-theme-info',
'/features/belise-big-title',
'/sections/belise-big-title-section',
'/sections/belise-about-section',
'/features/belise-menus',
'/sections/belise-menus-section',
'/sections/belise-ribbon-section',
'/sections/belise-taxonomy-meta-image',
'/features/belise-copyright',
'/features/belise-sharing-icons',
'/features/meta-controls/meta-functions',
'/features/belise-about',
'/customizer/customizer-color-scheme/functions',
'/features/belise-pro-features',
'/features/belise-about-page',
)
);
}
add_filter( 'belise_filter_features', 'belise_filter_features' );
/**
* Include features files.
*
* @since Belise 1.0
*/
function belise_include_features() {
$belise_allowed_phps = array();
$belise_allowed_phps = apply_filters( 'belise_filter_features', $belise_allowed_phps );
foreach ( $belise_allowed_phps as $file ) {
$belise_file_to_include = BELISE_PHP_INCLUDE . $file . '.php';
if ( file_exists( $belise_file_to_include ) ) {
include_once( $belise_file_to_include );
}
}
}
add_action( 'after_setup_theme', 'belise_include_features' );
if ( file_exists( BELISE_PHP_INCLUDE . '/belise-main-events-functions.php' ) ) {
require_once( BELISE_PHP_INCLUDE . '/belise-main-events-functions.php' );
}
/**
* Change comments appearance
*
* @since Belise 1.0
*/
function belise_comment( $comment, $args, $depth ) {
if ( 'div' === $args['style'] ) {
$tag = 'div';
$add_below = 'comment';
} else {
$tag = 'li';
$add_below = 'div-comment';
}
?>
< id="comment-">
'Orbit Fox',
'slug' => 'themeisle-companion',
'required' => false,
),
array(
'name' => 'Jetpack by WordPress.com',
'slug' => 'jetpack',
'required' => false,
),
array(
'name' => 'Event Organiser',
'slug' => 'event-organiser',
'required' => false,
),
);
tgmpa( $plugins );
}
add_action( 'tgmpa_register', 'belise_register_required_plugins' );
/**
* Filter to translate strings
*
* @since 1.1.0
* @access public
*/
function belise_translate_single_string( $original_value, $domain ) {
if ( is_customize_preview() ) {
$wpml_translation = $original_value;
} else {
$wpml_translation = apply_filters( 'wpml_translate_single_string', $original_value, $domain, $original_value );
if ( $wpml_translation === $original_value && function_exists( 'pll__' ) ) {
return pll__( $original_value );
}
}
return $wpml_translation;
}
add_filter( 'belise_translate_single_string', 'belise_translate_single_string', 10, 2 );
/**
* Filter to remove markup added by jetpack for nova menu
*
* @param string $tag Menu item's element opening tag.
* @param string $field Menu Item Markup settings field.
* @param array $markup Array of markup elements for the menu item.
* @param false|object $term Taxonomy term for current menu item.
*
* @since 1.1.0
* @access public
* @return string
*/
function belise_remove_nova_markup( $tag, $field, $markup, $term ) {
$term->name = '';
return '';
}
add_filter( 'jetpack_nova_menu_item_loop_open_element', 'belise_remove_nova_markup', 4, 999 );