parent()->get('Version')); wp_enqueue_style( 'digi-restaurant-style', get_stylesheet_uri(), array( $parentcss ), $theme->get('Version')); } add_action( 'wp_enqueue_scripts', 'digi_restaurant_enqueue_styles' ); function digi_restaurant_string_limit_words($string, $word_limit) { $words = explode(' ', $string, ($word_limit + 1)); if(count($words) > $word_limit) array_pop($words); return implode(' ', $words); } function digi_restaurant_customize_register($wp_customize){ // Banner Section $wp_customize->add_section( 'digi_restaurant_top_image_section' , array( 'title' => __( 'Banner Settings', 'digi-restaurant' ), 'priority' => null ) ); $wp_customize->add_setting('digi_restaurant_top_section_heading',array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('digi_restaurant_top_section_heading',array( 'label' => esc_html__('Section Title','digi-restaurant'), 'section' => 'digi_restaurant_top_image_section', 'setting' => 'digi_restaurant_top_section_heading', 'type' => 'text' )); $wp_customize->add_setting('digi_restaurant_top_section_content',array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('digi_restaurant_top_section_content',array( 'label' => esc_html__('Section Content','digi-restaurant'), 'section' => 'digi_restaurant_top_image_section', 'setting' => 'digi_restaurant_top_section_content', 'type' => 'text' )); $wp_customize->add_setting('digi_restaurant_top_section_text',array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('digi_restaurant_top_section_text',array( 'label' => esc_html__('Button Text','digi-restaurant'), 'section' => 'digi_restaurant_top_image_section', 'setting' => 'digi_restaurant_top_section_text', 'type' => 'text' )); $wp_customize->add_setting('digi_restaurant_top_section_url',array( 'default' => '', 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control('digi_restaurant_top_section_url',array( 'label' => esc_html__('Button URL','digi-restaurant'), 'section' => 'digi_restaurant_top_image_section', 'setting' => 'digi_restaurant_top_section_url', 'type' => 'url' )); $wp_customize->add_setting('digi_restaurant_image_one', array( 'transport' => 'refresh', 'height' => 325, 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'digi_restaurant_image_one', array( 'label' => esc_html__('Image #1', 'digi-restaurant'), 'section' => 'digi_restaurant_top_image_section', 'settings' => 'digi_restaurant_image_one', ))); $wp_customize->add_setting('digi_restaurant_image_two', array( 'transport' => 'refresh', 'height' => 325, 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'digi_restaurant_image_two', array( 'label' => esc_html__('Image #2', 'digi-restaurant'), 'section' => 'digi_restaurant_top_image_section', 'settings' => 'digi_restaurant_image_two', ))); $wp_customize->add_setting('digi_restaurant_image_three', array( 'transport' => 'refresh', 'height' => 325, 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'digi_restaurant_image_three', array( 'label' => esc_html__('Image #3', 'digi-restaurant'), 'section' => 'digi_restaurant_top_image_section', 'settings' => 'digi_restaurant_image_three', ))); $wp_customize->add_setting('digi_restaurant_image_four', array( 'transport' => 'refresh', 'height' => 325, 'sanitize_callback' => 'esc_url_raw' )); $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, 'digi_restaurant_image_four', array( 'label' => esc_html__('Image #4', 'digi-restaurant'), 'section' => 'digi_restaurant_top_image_section', 'settings' => 'digi_restaurant_image_four', ))); // Welcome Section $wp_customize->add_section( 'digi_restaurant_welcome_section' , array( 'title' => esc_html__( 'Welcome Section Settings', 'digi-restaurant' ), 'priority' => null ) ); $wp_customize->add_setting('digi_restaurant_welcome_section_heading',array( 'default' => '', 'sanitize_callback' => 'sanitize_text_field' )); $wp_customize->add_control('digi_restaurant_welcome_section_heading',array( 'label' => esc_html__('Section Heading','digi-restaurant'), 'section' => 'digi_restaurant_welcome_section', 'setting' => 'digi_restaurant_welcome_section_heading', 'type' => 'text' )); $wp_customize->add_setting( 'digi_restaurant_welcome_page', array( 'default' => '', 'sanitize_callback' => 'restaurant_zone_sanitize_dropdown_pages' ) ); $wp_customize->add_control( 'digi_restaurant_welcome_page', array( 'label' => esc_html__( 'Select Page', 'digi-restaurant' ), 'section' => 'digi_restaurant_welcome_section', 'type' => 'dropdown-pages' ) ); } add_action('customize_register', 'digi_restaurant_customize_register'); if ( ! function_exists( 'digi_restaurant_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 digi_restaurant_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('digi-restaurant-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( 'restaurant_zone_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', 'digi_restaurant_setup' ); function digi_restaurant_font_url(){ $font_url = ''; $lobster = _x('on','Berkshire Swash:on or off','digi-restaurant'); if('off' !== $lobster ){ $font_family = array(); if('off' !== $lobster){ $font_family[] = 'Berkshire Swash'; } $query_args = array( 'family' => urlencode(implode('|',$font_family)), ); $font_url = add_query_arg($query_args,'//fonts.googleapis.com/css'); } return $font_url; } function digi_restaurant_remove_customize_register() { global $wp_customize; $wp_customize->remove_section( 'restaurant_zone_color_option' ); $wp_customize->remove_section( 'restaurant_zone_top_slider' ); $wp_customize->remove_section( 'restaurant_zone_menu_items_section' ); } add_action( 'customize_register', 'digi_restaurant_remove_customize_register', 11 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function digi_restaurant_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'digi-restaurant' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'digi-restaurant' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h5 class="widget-title">', 'after_title' => '</h5>', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Column 1', 'digi-restaurant' ), 'id' => 'restaurant-zone-footer1', 'description' => '', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h5 class="footer-column-widget-title">', 'after_title' => '</h5>', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Column 2', 'digi-restaurant' ), 'id' => 'restaurant-zone-footer2', 'description' => '', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h5 class="footer-column-widget-title">', 'after_title' => '</h5>', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Column 3', 'digi-restaurant' ), 'id' => 'restaurant-zone-footer3', 'description' => '', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h5 class="footer-column-widget-title">', 'after_title' => '</h5>', ) ); } add_action( 'widgets_init', 'digi_restaurant_widgets_init' );