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( 'blog-img', 300, 260, true ); /** * Custom editor style initialize */ add_editor_style(); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Andar Menu', 'andar' ), ) ); onepage_default_menu(); /* * 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', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'andar_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); } endif; add_action( 'after_setup_theme', 'andar_setup' ); /** * function to setup default theme menu */ function onepage_default_menu() { $menuname = 'Andar Menu'; $menulocation = 'primary'; // Does the menu exist already? $menu_exists = wp_get_nav_menu_object($menuname); // If it doesn't exist, let's create it. if (!$menu_exists) { $menu_id = wp_create_nav_menu($menuname); // Set up default OnePage Menu links and add them to the menu. wp_update_nav_menu_item($menu_id, 0, array( 'menu-item-title' => __('Home', 'andar'), 'menu-item-classes' => 'home', 'menu-item-url' => '#page-top', 'menu-item-status' => 'publish')); wp_update_nav_menu_item($menu_id, 0, array( 'menu-item-title' => __('Services', 'andar'), 'menu-item-classes' => 'services', 'menu-item-url' => '#services', 'menu-item-status' => 'publish')); wp_update_nav_menu_item($menu_id, 0, array( 'menu-item-title' => __('Blog', 'andar'), 'menu-item-classes' => 'blog', 'menu-item-url' => '#blog', 'menu-item-status' => 'publish')); // wp_update_nav_menu_item($menu_id, 0, array( // 'menu-item-title' => __('Gallery', 'one-page'), // 'menu-item-classes' => 'gallery', // 'menu-item-url' => '#gallery', // 'menu-item-status' => 'publish')); wp_update_nav_menu_item($menu_id, 0, array( 'menu-item-title' => __('Pricing', 'andar'), 'menu-item-classes' => 'pricing', 'menu-item-url' => '#pricing', 'menu-item-status' => 'publish')); wp_update_nav_menu_item($menu_id, 0, array( 'menu-item-title' => __('Team', 'andar'), 'menu-item-classes' => 'team', 'menu-item-url' => '#team', 'menu-item-status' => 'publish')); wp_update_nav_menu_item($menu_id, 0, array( 'menu-item-title' => __('Contact', 'andar'), 'menu-item-classes' => 'contact', 'menu-item-url' => '#contact', 'menu-item-status' => 'publish')); // Grab the theme locations and assign our newly-created menu // to the OnePage Theme front Page menu location. if (!has_nav_menu($menulocation)) { $locations = get_theme_mod('nav_menu_locations'); $locations[$menulocation] = $menu_id; set_theme_mod('nav_menu_locations', $locations); } } } /** * 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 andar_content_width() { $GLOBALS['content_width'] = apply_filters( 'andar_content_width', 640 ); } add_action( 'after_setup_theme', 'andar_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function andar_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'andar' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'andar' ), 'before_widget' => '', 'before_title' => '