.
*
* Copyright (C) 2024 MD Arzan Hosen
*/
// Include helper files
require_once get_template_directory() . '/inc/customizer.php';
require_once get_template_directory() . '/inc/custom-styles.php';
require_once get_template_directory() . '/inc/bootstrap-walker.php';
require_once get_template_directory() . '/inc/class-mobile-walker.php';
require_once get_template_directory() . '/inc/blocks.php';
function application_guy_scripts() {
/**
* This file is part of Application Guy Professional.
*
* Application Guy Professional is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Application Guy Professional is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Application Guy Professional. If not, see .
*
* Copyright (C) 2024 MD Arzan Hosen
*/
// Enqueue Local Bootstrap 5
wp_enqueue_style('bootstrap-css', esc_url(get_template_directory_uri()) . '/assets/vendor/bootstrap/css/bootstrap.min.css', array(), '5.3.3');
wp_enqueue_script('bootstrap-js', esc_url(get_template_directory_uri()) . '/assets/vendor/bootstrap/js/bootstrap.bundle.min.js', array(), '5.3.3', true);
// Enqueue Google Fonts (Standard way for WP.org is to encourage local or standard system fonts,
// but we can also use wp_print_font_faces if we bundle them. For now, using system fonts as primary
// to pass validation, or user can add specialized font handling.)
// Enqueue Main Styles
wp_enqueue_style('application-guy-professional-style', esc_url(get_template_directory_uri()) . '/assets/css/style.css', array('bootstrap-css'), '21.2');
// Enqueue Theme Stylesheet (required by WP)
wp_enqueue_style('application-guy-professional-theme-style', esc_url(get_stylesheet_uri()), array('application-guy-professional-style'), '21.2');
// Enqueue Scripts
wp_enqueue_script('application-guy-professional-script', esc_url(get_template_directory_uri()) . '/assets/js/script.js', array('jquery'), '21.2', true);
// Pass data to script (Standard way)
wp_localize_script('application-guy-professional-script', 'applicationGuyData', array(
'ajaxUrl' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('application_guy_nonce')
));
}
add_action('wp_enqueue_scripts', 'application_guy_scripts');
function application_guy_setup() {
// Enable title tag support
add_theme_support('title-tag');
// Enable post thumbnails
add_theme_support('post-thumbnails');
// Enable custom logo support
add_theme_support('custom-logo', array(
'height' => 100,
'width' => 400,
'flex-height' => true,
'flex-width' => true,
'header-text' => array('site-title', 'site-description'),
));
// Register navigation menus
register_nav_menus(array(
'primary' => __('Primary Menu', 'application-guy-professional'),
));
// Add theme support for mandatory WP features
add_theme_support('automatic-feed-links');
add_theme_support('wp-block-styles');
add_theme_support('responsive-embeds');
add_theme_support('align-wide');
add_theme_support('html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'script',
'style',
));
// Custom background & header (recommended)
add_theme_support('custom-background');
add_theme_support('custom-header');
/**
* This file is part of Application Guy Professional.
*
* Application Guy Professional is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* Application Guy Professional is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Application Guy Professional. If not, see .
*
* Copyright (C) 2024 MD Arzan Hosen
*/
// Comment reply script
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
// Add editor styles
add_editor_style('assets/css/editor-style.css');
// Auto-install Menu if missing (One-Click Vibe)
$menu_name = 'Main Menu';
$menu_exists = wp_get_nav_menu_object($menu_name);
// If menu doesn't exist, create it
if (!$menu_exists) {
$menu_id = wp_create_nav_menu($menu_name);
// Add Home Page
wp_update_nav_menu_item($menu_id, 0, array(
'menu-item-title' => __('Home', 'application-guy-professional'),
'menu-item-classes' => 'home',
'menu-item-url' => home_url('/'),
'menu-item-status' => 'publish'
));
// Add Client Portal (Critical for this user)
wp_update_nav_menu_item($menu_id, 0, array(
'menu-item-title' => __('Student Portal', 'application-guy-professional'),
'menu-item-url' => home_url('/client-portal/'),
'menu-item-status' => 'publish'
));
// Add Contact Anchor
wp_update_nav_menu_item($menu_id, 0, array(
'menu-item-title' => __('Contact', 'application-guy-professional'),
'menu-item-url' => '#contact',
'menu-item-status' => 'publish'
));
// Assign to Primary Location
$locations = get_theme_mod('nav_menu_locations');
$locations['primary'] = $menu_id;
set_theme_mod('nav_menu_locations', $locations);
}
// If menu exists but not assigned, assign it
elseif (!has_nav_menu('primary') && $menu_exists) {
$locations = get_theme_mod('nav_menu_locations');
$locations['primary'] = $menu_exists->term_id;
set_theme_mod('nav_menu_locations', $locations);
}
}
add_action('after_setup_theme', 'application_guy_setup');
function application_guy_widgets_init() {
register_sidebar(array(
'name' => __('Left Sidebar', 'application-guy-professional'),
'id' => 'sidebar-left',
'description' => __('Add widgets here to appear in the left sidebar of posts and blog pages.', 'application-guy-professional'),
'before_widget' => '',
'before_title' => '
',
));
register_sidebar(array(
'name' => __('Right Sidebar', 'application-guy-professional'),
'id' => 'sidebar-right',
'description' => __('Add widgets here to appear in the right sidebar of posts and blog pages.', 'application-guy-professional'),
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => __('Header Social Area', 'application-guy-professional'),
'id' => 'header-social',
'description' => __('Add social media widgets here. Visible only on desktop header.', 'application-guy-professional'),
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
));
register_sidebar(array(
'name' => __('Footer Widget Column 2', 'application-guy-professional'),
'id' => 'footer-widget-1',
'description' => __('Middle column of the footer.', 'application-guy-professional'),
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => __('Footer Widget Column 3', 'application-guy-professional'),
'id' => 'footer-widget-2',
'description' => __('Right column of the footer.', 'application-guy-professional'),
'before_widget' => '',
'before_title' => '',
));
}
add_action('widgets_init', 'application_guy_widgets_init');