esc_html__('Sidebar Default', 'maia'),
'id' => 'sidebar-default',
'description' => esc_html__('Add widgets here to appear in your Sidebar.', 'maia'),
'before_widget' => '',
'before_title' => '
',
));
/* Check WPML */
if (function_exists('icl_object_id')) {
register_sidebar(array(
'name' => esc_html__('WPML Sidebar', 'maia'),
'id' => 'wpml-sidebar',
'description' => esc_html__('Add widgets here to appear.', 'maia'),
'before_widget' => '',
'before_title' => '',
));
}
/* End check WPML */
register_sidebar(array(
'name' => esc_html__('Footer', 'maia'),
'id' => 'footer',
'description' => esc_html__('Add widgets here to appear in your sidebar.', 'maia'),
'before_widget' => '',
'before_title' => '',
));
}
public function add_cpt_support()
{
$cpt_support = ['tbay_custom_post', 'post', 'page', 'product'];
update_option('elementor_cpt_support', $cpt_support);
update_option('elementor_disable_color_schemes', 'yes');
update_option('elementor_disable_typography_schemes', 'yes');
update_option('elementor_container_width', '1200');
update_option('elementor_viewport_lg', '1200');
update_option('elementor_space_between_widgets', '0');
update_option('elementor_load_fa4_shim', 'yes');
// update_option('sb_instagram_custom_template', 'yes');
}
public function edit_post_show_excerpt($user_login, $user)
{
update_user_meta($user->ID, 'metaboxhidden_post', true);
}
public function instagram_use_theme_templates()
{
if (apply_filters('maia_sb_instagram_custom_template', true)) {
$active = true;
} else {
$active = false;
}
return $active;
}
/**
* Use front-page.php when Front page displays is set to a static page.
*
* @param string $template front-page.php.
*
* @return string The template to be used: blank if is_home() is true (defaults to index.php), else $template.
*/
public function front_page_template($template)
{
return is_home() ? '' : $template;
}
public function load_textdomain() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on ruza, use a find and replace
* to change 'ruza' to the name of your theme in all the template files
*/
load_theme_textdomain('maia', MAIA_THEMEROOT . '/languages');
}
public function setup()
{
// Add default posts and comments RSS feed links to head.
add_theme_support('automatic-feed-links');
add_theme_support("post-thumbnails");
add_image_size('maia_avatar_post_carousel', 100, 100, true);
// This theme styles the visual editor with editor-style.css to match the theme style.
$font_source = maia_tbay_get_config('show_typography', false);
if (!$font_source) {
add_editor_style(array( 'css/editor-style.css', $this->fonts_url() ));
}
/*
* 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');
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support('html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption','search-canvas'
));
/*
* Enable support for Post Formats.
*
* See: https://codex.wordpress.org/Post_Formats
*/
add_theme_support('post-formats', array(
'aside', 'image', 'video', 'gallery', 'audio'
));
$color_scheme = maia_tbay_get_color_scheme();
$default_color = trim($color_scheme[0], '#');
// Setup the WordPress core custom background feature.
add_theme_support('custom-background', apply_filters('maia_custom_background_args', array(
'default-color' => $default_color,
'default-attachment' => 'fixed',
)));
add_action('wp_login', array( $this, 'edit_post_show_excerpt'), 10, 2);
if( apply_filters('maia_remove_widgets_block_editor', true) ) {
remove_theme_support( 'block-templates' );
remove_theme_support( 'widgets-block-editor' );
/*Remove extendify--spacing--larg CSS*/
update_option('use_extendify_templates', '');
}
// This theme uses wp_nav_menu() in two locations.
register_nav_menus(array(
'primary' => esc_html__('Primary Menu', 'maia'),
'mobile-menu' => esc_html__('Mobile Menu', 'maia'),
'nav-category-menu' => esc_html__('Nav Category Menu', 'maia'),
'track-order' => esc_html__('Tracking Order Menu', 'maia'),
));
update_option('page_template', 'elementor_header_footer');
}
public function load_fonts_url()
{
$protocol = is_ssl() ? 'https:' : 'http:';
$show_typography = maia_tbay_get_config('show_typography', false);
$font_source = maia_tbay_get_config('font_source', "1");
$font_google_code = maia_tbay_get_config('font_google_code');
if (!$show_typography) {
wp_enqueue_style('maia-theme-fonts', $this->fonts_url(), array(), null);
} elseif ($font_source == "2" && !empty($font_google_code)) {
wp_enqueue_style('maia-theme-fonts', $font_google_code, array(), null);
}
}
public function fonts_url()
{
/**
* Load Google Front
*/
$fonts_url = '';
/* Translators: If there are cmaiacters in your language that are not
* supported by Montserrat, translate this to 'off'. Do not translate
* into your own language.
*/
$Lato = _x('on', 'Lato font: on or off', 'maia');
$Cormorant_Garamond = _x('on', 'Cormorant Garamond font: on or off', 'maia');
if ('off' !== $Lato) {
$font_families = array();
if ('off' !== $Lato) {
$font_families[] = 'Lato:400,500,600,700';
}
if ( 'off' !== $Cormorant_Garamond ) {
$font_families[] = 'Cormorant Garamond:400,500,600,700';
}
$query_args = array(
'family' => rawurlencode( implode('|', $font_families) ),
'subset' => urlencode('latin,latin-ext'),
'display' => urlencode('swap'),
);
$protocol = is_ssl() ? 'https:' : 'http:';
$fonts_url = add_query_arg($query_args, $protocol .'//fonts.googleapis.com/css');
}
return esc_url_raw($fonts_url);
}
}
return new maia_setup_theme();