parent()->get('Version')); wp_enqueue_style( 'author-book-publisher-style', get_stylesheet_uri(), array( $author_book_publisher_parentcss ), $author_book_publisher_theme->get('Version')); require get_theme_file_path( '/custom-option.php' ); wp_add_inline_style( 'author-book-publisher-style',$digital_books_theme_css ); require get_parent_theme_file_path( '/custom-option.php' ); wp_add_inline_style( 'digital-books-style',$digital_books_theme_css ); wp_enqueue_script( 'comment-reply', '/wp-includes/js/comment-reply.min.js', array(), false, true ); } add_action( 'wp_enqueue_scripts', 'author_book_publisher_enqueue_styles' ); require get_stylesheet_directory() . '/inc/tgm/tgm.php'; function digital_books_child_remove_parent_scripts() { remove_action( 'wp_enqueue_scripts', 'digital_books_main_scripts' ); } add_action( 'wp_loaded', 'digital_books_child_remove_parent_scripts' ); function author_book_publisher_child_overwrite_scripts() { wp_enqueue_script('digital-books-theme-js',get_stylesheet_directory_uri() . '/assets/js/theme-script.js',array('jquery'),filemtime(get_stylesheet_directory() . '/assets/js/theme-script.js'),true); wp_enqueue_script('bootstrap',get_stylesheet_directory_uri() . '/assets/js/bootstrap.min.js',array('jquery'),filemtime(get_stylesheet_directory() . '/assets/js/bootstrap.min.js'),true ); } add_action('wp_enqueue_scripts', 'author_book_publisher_child_overwrite_scripts', 20); function author_book_publisher_customize_register($wp_customize){ // Pro Version class Author_Book_Publisher_Customize_Pro_Version extends WP_Customize_Control { public $type = 'pro_options'; public function render_content() { echo 'For More '. esc_html( $this->label ) .'?'; echo ''; echo ''; echo ' '. esc_html( DIGITAL_BOOKS_BUY_TEXT,'author-book-publisher' ) .''; echo ''; } } // Header $wp_customize->add_section('author_book_publisher_header',array( 'title' => esc_html__('Header Section','author-book-publisher'), )); $wp_customize->add_setting('author_book_publisher_topbar_text', array( 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('author_book_publisher_topbar_text', array( 'label' => __('Topbar Text', 'author-book-publisher'), 'section' => 'author_book_publisher_header', 'priority' => 1, 'type' => 'text', )); $wp_customize->add_setting('author_book_publisher_topbarbtn1_text',array( 'default'=> '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('author_book_publisher_topbarbtn1_text',array( 'label' => __('Register Button Text','author-book-publisher'), 'section'=> 'author_book_publisher_header', 'type'=> 'text', 'priority' => 11 )); $wp_customize->add_setting('author_book_publisher_topbarbtn1_url',array( 'default' => '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('author_book_publisher_topbarbtn1_url',array( 'label' => esc_html__('Register Button Url','author-book-publisher'), 'section' => 'author_book_publisher_header', 'setting' => 'author_book_publisher_topbarbtn1_url', 'type' => 'url', 'priority' => 11 )); //Slider Extra Title $wp_customize->add_setting('author_book_publisher_slider_extra_title_setting',array( 'default'=> '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('author_book_publisher_slider_extra_title_setting',array( 'label' => __('Slider Sub Heading','author-book-publisher'), 'section'=> 'digital_books_top_slider', 'type'=> 'text', 'priority' => 11 )); //Slider button text $wp_customize->add_setting('digital_books_slider_button2_text',array( 'default'=> '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('digital_books_slider_button2_text',array( 'label' => __('Slider 2 Button Text','author-book-publisher'), 'section'=> 'digital_books_top_slider', 'type'=> 'text', 'priority' => 11 )); $wp_customize->add_setting('digital_books_slider_button2_url',array( 'default' => '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('digital_books_slider_button2_url',array( 'label' => esc_html__('Slider 2 Button Url','author-book-publisher'), 'section' => 'digital_books_top_slider', 'setting' => 'digital_books_slider_button2_url', 'type' => 'url', 'priority' => 11 )); // Products $wp_customize->add_section('author_book_publisher_latest_product',array( 'title' => esc_html__('Category Section','author-book-publisher'), )); $wp_customize->add_setting('author_book_publisher_activities_section_setting', array( 'default' => false, 'sanitize_callback' => 'digital_books_sanitize_checkbox' )); $wp_customize->add_control( new WP_Customize_Control($wp_customize,'author_book_publisher_activities_section_setting',array( 'label' => __( 'Show Category Tabs', 'author-book-publisher' ), 'section' => 'author_book_publisher_latest_product', 'settings' => 'author_book_publisher_activities_section_setting', 'type' => 'checkbox', ))); $wp_customize->add_setting('author_book_publisher_services_heading',array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('author_book_publisher_services_heading',array( 'label' => esc_html__('Heading','author-book-publisher'), 'section' => 'author_book_publisher_latest_product', 'setting' => 'author_book_publisher_services_heading', 'type' => 'text' )); $wp_customize->add_setting('author_book_publisher_services_category_heading',array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('author_book_publisher_services_category_heading',array( 'label' => esc_html__('Category Heading','author-book-publisher'), 'section' => 'author_book_publisher_latest_product', 'setting' => 'author_book_publisher_services_category_heading', 'type' => 'text' )); for($author_book_publisher_i=1; $author_book_publisher_i<= 5; $author_book_publisher_i++) { $wp_customize->add_setting('author_book_publisher_slideproduct_tab1title'.$author_book_publisher_i,array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field', )); $wp_customize->add_control('author_book_publisher_slideproduct_tab1title'.$author_book_publisher_i,array( 'label' => __('Tab Heading','author-book-publisher').$author_book_publisher_i, 'section' => 'author_book_publisher_latest_product', 'setting' => 'author_book_publisher_slideproduct_tab1title'.$author_book_publisher_i, 'type' => 'text' )); $args = array( 'type' => 'product', 'child_of' => 0, 'parent' => '', 'orderby' => 'term_group', 'order' => 'ASC', 'hide_empty' => false, 'hierarchical' => 1, 'number' => '', 'taxonomy' => 'product_cat', 'pad_counts' => false ); $categories = get_categories($args); $cat_posts = array(); $m = 0; $cat_posts[]='Select'; foreach($categories as $product){ if($m==0){ $default = $product->slug; $m++; } $cat_posts[$product->slug] = $product->name; } $wp_customize->add_setting('author_book_publisher_cate_tab'.$author_book_publisher_i,array( 'default' => 'select', 'sanitize_callback' => 'digital_books_sanitize_choices', )); $wp_customize->add_control('author_book_publisher_cate_tab'.$author_book_publisher_i,array( 'type' => 'select', 'choices' => $cat_posts, 'label' => __('Select category to display products ','author-book-publisher').$author_book_publisher_i, 'section' => 'author_book_publisher_latest_product', )); } // Pro Version $wp_customize->add_setting( 'pro_version_latest_product_setting', array( 'sanitize_callback' => 'Digital_Books_sanitize_custom_control' )); $wp_customize->add_control( new Author_Book_Publisher_Customize_Pro_Version ( $wp_customize,'pro_version_latest_product_setting', array( 'section' => 'author_book_publisher_latest_product', 'type' => 'pro_options', 'label' => esc_html__( 'Customizer Options', 'author-book-publisher' ), 'description' => esc_url( DIGITAL_BOOKS_URL ), 'priority' => 100 ))); } add_action('customize_register', 'author_book_publisher_customize_register'); if ( ! function_exists( 'author_book_publisher_setup' ) ) : /** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which * runs before the init hook. The init hook is too late for some features, such * as indicating support for post thumbnails. */ function author_book_publisher_setup() { add_theme_support( 'responsive-embeds' ); // Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); /* * 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' ); /* * 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' ); add_image_size('author-book-publisher-featured-header-image', 2000, 660, true); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'digital_books_custom_background_args', array( 'default-color' => '', 'default-image' => '', ) ) ); /** * Add support for core custom logo. * * @link https://codex.wordpress.org/Theme_Logo */ add_theme_support( 'custom-logo', array( 'height' => 50, 'width' => 50, 'flex-width' => true, ) ); add_editor_style( array( '/editor-style.css' ) ); add_theme_support( 'align-wide' ); add_theme_support( 'wp-block-styles' ); } endif; add_action( 'after_setup_theme', 'author_book_publisher_setup' ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function author_book_publisher_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'author-book-publisher' ), 'id' => 'sidebar', 'description' => esc_html__( 'Add widgets here.', 'author-book-publisher' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h5 class="widget-title">', 'after_title' => '</h5>', ) ); } add_action( 'widgets_init', 'author_book_publisher_widgets_init' ); if( !function_exists('author_book_publisher_content_offcanvas') ): // Offcanvas Contents function author_book_publisher_content_offcanvas(){ ?> <div id="offcanvas-menu"> <div class="offcanvas-wraper"> <div class="close-offcanvas-menu"> <div class="offcanvas-close"> <a href="javascript:void(0)" class="skip-link-menu-start"></a> <button type="button" class="button-offcanvas-close"> <span class="offcanvas-close-label"> <i class="fas fa-times"></i> </span> </button> </div> </div> <div id="primary-nav-offcanvas" class="offcanvas-item offcanvas-main-navigation"> <nav class="primary-menu-wrapper" aria-label="<?php esc_attr_e('Horizontal', 'author-book-publisher'); ?>" role="navigation"> <ul class="primary-menu theme-menu"> <?php if (has_nav_menu('primary')) { wp_nav_menu( array( 'container' => '', 'items_wrap' => '%3$s', 'theme_location' => 'primary', 'show_toggles' => true, ) ); }else{ wp_list_pages( array( 'match_menu_classes' => true, 'show_sub_menu_icons' => true, 'title_li' => false, 'show_toggles' => true, 'walker' => new Digital_Books_Menu_Page(), ) ); } ?> </ul> </nav><!-- .primary-menu-wrapper --> </div> <a href="javascript:void(0)" class="skip-link-menu-end"></a> </div> </div> <?php } endif; add_action( 'author_book_publisher_before_footer_content_action','author_book_publisher_content_offcanvas',30 ); function author_book_publisher_remove_my_action() { remove_action( 'remove_menu_page','digital-books-info' ); remove_action( 'admin_menu','demo_importer_admin_page' ); remove_action( 'admin_enqueue_scripts', 'digital_books_getpage_css' ); remove_action( 'admin_notices', 'digital_books_deprecated_hook_admin_notice' ); remove_action( 'remove_menu_page','digital-books-info' ); remove_action( 'admin_menu','digital_books_demo_importer_admin_page' ); remove_action( 'admin_notices','digital_books_deprecated_hook_admin_notice' ); } add_action( 'after_setup_theme', 'author_book_publisher_remove_my_action'); function author_book_publisher_remove_parent_theme_hooks() { remove_action('init', 'digital_books_remove_my_action'); } add_action('after_setup_theme', 'author_book_publisher_remove_parent_theme_hooks', 20); add_action('admin_menu', 'author_book_publisher_remove_my_theme_page', 999); function author_book_publisher_remove_my_theme_page() { remove_submenu_page('themes.php','digital-books-info'); } function author_book_publisher_child_reset_color_section( $wp_customize ) { // Remove parent theme color option section $wp_customize->remove_section( 'digital_books_color_option' ); } add_action( 'customize_register', 'author_book_publisher_child_reset_color_section', 99 );