<?php

/* ------------------------------------------------------------------------------
* Author: web-zone.org
* @package Bado Blog
* Description: Functions
* ------------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------------
* Attention!
* Do not edit this file, after updating all changes will be lost
* To add your own functions, use a special free plugin
* The plugin can be downloaded from web-zone.org
* ------------------------------------------------------------------------------ */
// SDK
if ( file_exists( get_template_directory() . '/vendor/freemius/start.php' ) ) {
    if ( !function_exists( 'badoblog_fs' ) ) {
        // Create a helper function for easy SDK access.
        function badoblog_fs() {
            global $badoblog_fs;
            if ( !isset( $badoblog_fs ) ) {
                // Include Freemius SDK.
                require_once dirname( __FILE__ ) . '/vendor/freemius/start.php';
                $badoblog_fs = fs_dynamic_init( array(
                    'id'              => '16434',
                    'slug'            => 'bado-blog',
                    'type'            => 'theme',
                    'public_key'      => 'pk_b6212040cb38d3f163ca1a930a219',
                    'is_premium'      => false,
                    'has_addons'      => true,
                    'has_paid_plans'  => true,
                    'has_affiliation' => 'all',
                    'menu'            => array(
                        'slug'    => 'dmcwzmulti_page_settings',
                        'support' => false,
                        'parent'  => array(
                            'slug' => 'themes.php',
                        ),
                    ),
                    'navigation'      => 'tabs',
                    'is_live'         => true,
                ) );
            }
            return $badoblog_fs;
        }

        // Init Freemius.
        badoblog_fs();
        // Signal that SDK was initiated.
        do_action( 'badoblog_fs_loaded' );
    }
}
// If SDK code change, add - 'navigation' => 'tabs'
// Remove monthly plans
badoblog_fs()->add_filter( 'pricing/show_annual_in_monthly', '__return_false' );
// Translation the theme
function badoblog_fun_language_theme() {
    load_theme_textdomain( 'bado-blog', false, get_template_directory() . '/languages' );
    // Language TABs Freemius
    fs_override_i18n( array(
        'contact-us'  => esc_html__( 'Contact', 'bado-blog' ),
        'account'     => esc_html__( 'Account', 'bado-blog' ),
        'pricing'     => esc_html__( 'Pricing', 'bado-blog' ),
        'upgrade'     => esc_html__( 'Upgrade', 'bado-blog' ),
        'add-ons'     => esc_html__( 'Add-Ons', 'bado-blog' ),
        'affiliation' => esc_html__( 'Affiliate program', 'bado-blog' ),
    ), 'bado-blog' );
    // Theme description (for translations - style.css)
    esc_html__( 'Bado Blog is a cool, modern multipurpose WordPress theme with many free settings to create a responsive, fast, SEO optimized website that is easy to modify with a visual customizer. Bado Blog is well suited for magazines, personal blogs, article sites, news, and media. Translated into 20+ languages. Easy to use without coding knowledge. Good flexibility and functionality - multiple site width options (with full-width option), change sidebar orientation (left, right, or no sidebar), category grids with vertical and horizontal posts of various sizes, flexible header with logo, social link builder, ticker, 4 menu locations, main menu (mega menu), breadcrumbs, three pagination options, author block, related posts block, and styled widgets. Powerful Typography – change font size and line height, choose font designs, color typography for posts and pages. Clean code, no frameworks, minimum scripts. Good adaptability for any mobile devices. SEO-optimized with correct headings and markup. Adaptation for WooCommerce, Elementor, bbPress, Events Calendar, Jetpack, WPML, Contact Form 7, and Newsletter. Demo – web-zone.org/bado-blog', 'bado-blog' );
}

add_action( 'init', 'badoblog_fun_language_theme' );
// Files connection
require get_template_directory() . '/inc/general.php';
/* ------------------------------------------------------------------------------
* Attention!
* Do not edit this file, after updating all changes will be lost
* To add your own functions, use a special free plugin
* The plugin can be downloaded from web-zone.org
* ------------------------------------------------------------------------------ */
// Fix WordPress 6.7 +
if ( version_compare( get_bloginfo( 'version' ), '6.7', '>=' ) ) {
    // Urgent fix for images after the release of WordPress 6.7 +
    add_filter( 'wp_content_img_tag', static function ( $image ) {
        return str_replace( ' sizes="auto, ', ' sizes="', $image );
    } );
    add_filter( 'wp_get_attachment_image_attributes', static function ( $attr ) {
        if ( isset( $attr['sizes'] ) ) {
            $attr['sizes'] = preg_replace( '/^auto, /', '', $attr['sizes'] );
        }
        return $attr;
    } );
}