get( 'Version' ) ); if( ! defined( 'ARCHITECTURE_CONSTRUCTION_THEME_NAME' ) ) define( 'ARCHITECTURE_CONSTRUCTION_THEME_NAME', $architecture_construction_theme_data->get( 'Name' ) ); if ( ! function_exists( 'architecture_construction_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 architecture_construction_setup() { // 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' ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Primary', 'architecture-construction' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-list', 'gallery', 'caption', ) ); /* * Enable support for Post Formats. * See https://developer.wordpress.org/themes/functionality/post-formats/ */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat' ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'architecture_construction_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); /* Custom Logo */ add_theme_support( 'custom-logo', array( 'header-text' => array( 'site-title', 'site-description' ), ) ); } endif; add_action( 'after_setup_theme', 'architecture_construction_setup' ); /** * 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 architecture_construction_content_width() { $GLOBALS['content_width'] = apply_filters( 'architecture_construction_content_width', 780 ); } add_action( 'after_setup_theme', 'architecture_construction_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function architecture_construction_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Right Sidebar', 'architecture-construction' ), 'id' => 'right-sidebar', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer One', 'architecture-construction' ), 'id' => 'footer-one', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Two', 'architecture-construction' ), 'id' => 'footer-two', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Three', 'architecture-construction' ), 'id' => 'footer-three', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer Four', 'architecture-construction' ), 'id' => 'footer-four', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h2 class="widget-title">', 'after_title' => '</h2>', ) ); } add_action( 'widgets_init', 'architecture_construction_widgets_init' ); if( ! function_exists( 'architecture_construction_scripts' ) ) : /** * Enqueue scripts and styles. */ function architecture_construction_scripts() { // Use minified libraries if SCRIPT_DEBUG is false $architecture_construction_build = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '/build' : ''; $architecture_construction_suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; wp_enqueue_style( 'bootstrap-style', get_template_directory_uri().'/css/build/bootstrap.css' ); wp_enqueue_style( 'owl.carousel', get_template_directory_uri() . '/css/build/owl.carousel.css' ); wp_enqueue_style( 'architecture-construction-style', get_stylesheet_uri(), array(), ARCHITECTURE_CONSTRUCTION_THEME_VERSION ); if( architecture_construction_woocommerce_activated() ) wp_enqueue_style( 'architecture-construction-woocommerce-style', get_template_directory_uri(). '/css' . $architecture_construction_build . '/woocommerce' . $architecture_construction_suffix . '.css', array('architecture-construction-style'), ARCHITECTURE_CONSTRUCTION_THEME_VERSION ); wp_enqueue_script( 'all', get_template_directory_uri() . '/js' . $architecture_construction_build . '/all' . $architecture_construction_suffix . '.js', array( 'jquery' ), '6.1.1', true ); wp_enqueue_script( 'v4-shims', get_template_directory_uri() . '/js' . $architecture_construction_build . '/v4-shims' . $architecture_construction_suffix . '.js', array( 'jquery' ), '6.1.1', true ); wp_enqueue_script( 'architecture-construction-modal-accessibility', get_template_directory_uri() . '/js' . $architecture_construction_build . '/modal-accessibility' . $architecture_construction_suffix . '.js', array( 'jquery' ), ARCHITECTURE_CONSTRUCTION_THEME_VERSION, true ); wp_enqueue_script( 'owl.carousel', get_template_directory_uri() . '/js/build/owl.carousel.js', array('jquery'), '2.6.0', true ); wp_enqueue_script( 'architecture-construction-js', get_template_directory_uri() . '/js/build/custom.js', array('jquery'), ARCHITECTURE_CONSTRUCTION_THEME_VERSION, true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } endif; add_action( 'wp_enqueue_scripts', 'architecture_construction_scripts' ); if( ! function_exists( 'architecture_construction_admin_scripts' ) ) : /** * Addmin scripts */ function architecture_construction_admin_scripts() { wp_enqueue_style( 'architecture-construction-admin-style',get_template_directory_uri().'/inc/css/admin.css', ARCHITECTURE_CONSTRUCTION_THEME_VERSION, 'screen' ); } endif; add_action( 'admin_enqueue_scripts', 'architecture_construction_admin_scripts' ); function architecture_construction_customize_enque_js(){ wp_enqueue_script( 'customizer', get_template_directory_uri() . '/inc/js/customizer.js', array('jquery'), '2.6.0', true ); } add_action( 'customize_controls_enqueue_scripts', 'architecture_construction_customize_enque_js', 0 ); if( ! function_exists( 'architecture_construction_block_editor_styles' ) ) : /** * Enqueue editor styles for Gutenberg */ function architecture_construction_block_editor_styles() { // Use minified libraries if SCRIPT_DEBUG is false $architecture_construction_build = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '/build' : ''; $architecture_construction_suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; // Block styles. wp_enqueue_style( 'architecture-construction-block-editor-style', get_template_directory_uri() . '/css' . $architecture_construction_build . '/editor-block' . $architecture_construction_suffix . '.css' ); } endif; add_action( 'enqueue_block_editor_assets', 'architecture_construction_block_editor_styles' ); /** * Display the admin notice unless dismissed. */ function architecture_construction_dashboard_notice() { // Check if the notice is dismissed $dismissed = get_user_meta(get_current_user_id(), 'architecture_construction_dismissable_notice', true); // Display the notice only if not dismissed if (!$dismissed) { ?> <div class="updated notice notice-success is-dismissible notice-get-started-class" data-notice="get-start" style="display: flex;padding: 10px;"> <p><?php echo esc_html('Clicking the "Getting Started" button will launch your theme discovery.', 'architecture-construction'); ?></p> <a style="margin-left: 30px; padding:5px 5px;" class="button button-primary" href="<?php echo esc_url(admin_url('themes.php?page=architecture-construction')); ?>"><?php esc_html_e('Getting Started', 'architecture-construction') ?></a> <a style="margin-left: 30px; padding:5px 5px;" class="button button-primary" target="_blank" href="<?php echo esc_url('https://demo.themeignite.com/documentation/architecture-construction-free'); ?>"><?php esc_html_e('Free Documentation', 'architecture-construction') ?></a> </div> <?php } } // Hook to display the notice add_action('admin_notices', 'architecture_construction_dashboard_notice'); /** * AJAX handler to dismiss the notice. */ function architecture_construction_dismissable_notice() { // Set user meta to indicate the notice is dismissed update_user_meta(get_current_user_id(), 'architecture_construction_dismissable_notice', true); die(); } // Hook for the AJAX action add_action('wp_ajax_architecture_construction_dismissable_notice', 'architecture_construction_dismissable_notice'); /** * Clear dismissed notice state when switching themes. */ function architecture_construction_switch_theme() { // Clear the dismissed notice state when switching themes delete_user_meta(get_current_user_id(), 'architecture_construction_dismissable_notice'); } // Hook for switching themes add_action('after_switch_theme', 'architecture_construction_switch_theme'); if ( ! function_exists( 'architecture_construction_sanitize_checkbox' ) ) : /** * Sanitize checkbox. * * @since 1.0.0 * */ function architecture_construction_sanitize_checkbox( $checked ) { return ( ( isset( $checked ) && true === $checked ) ? true : false ); } endif; /** * Sanitize number range. * */ function architecture_construction_sanitize_number_range( $input, $setting ) { // Ensure input is an absolute integer. $input = absint( $input ); // Get the input attributes associated with the setting. $atts = $setting->manager->get_control( $setting->id )->input_attrs; // Get min. $min = ( isset( $atts['min'] ) ? $atts['min'] : $input ); // Get max. $max = ( isset( $atts['max'] ) ? $atts['max'] : $input ); // Get Step. $architecture_construction_step = ( isset( $atts['step'] ) ? $atts['step'] : 1 ); // If the input is within the valid range, return it; otherwise, return the default. return ( $min <= $input && $input <= $max && is_int( $input / $architecture_construction_step ) ? $input : $setting->default ); } /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Custom functions that act independently of the theme templates. */ require get_template_directory() . '/inc/extra.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Social Links Widget */ require get_template_directory() . '/inc/widget-social-links.php'; /** * Implement the Custom Header feature. */ require get_template_directory() . '/inc/custom-header.php'; /** * Info Theme */ require get_template_directory() . '/inc/info.php'; /** * Load plugin for right and no sidebar */ if( architecture_construction_woocommerce_activated() ) { require get_template_directory() . '/inc/woocommerce-functions.php'; } /** * Getting Started */ require get_template_directory() . '/inc/getting-started/getting-started.php'; /** * Remove header text setting and control from the Customizer. */ function architecture_construction_remove_customizer_setting($wp_customize) { // Replace 'your_setting_id' with the actual ID or name of the setting you want to remove $wp_customize->remove_control('display_header_text'); $wp_customize->remove_setting('display_header_text'); } add_action('customize_register', 'architecture_construction_remove_customizer_setting'); function architecture_construction_customizer_css() { $architecture_construction_sidebar_text_align = get_theme_mod('sidebar_text_align', 'left'); ?> <style type="text/css"> .widget-area h2 { text-align: <?php echo esc_attr($architecture_construction_sidebar_text_align); ?>; } </style> <?php } add_action('wp_head', 'architecture_construction_customizer_css'); /** * Sanitize the text alignment options. * * @param string $input The input to be sanitized. * @return string The sanitized input. */ function architecture_construction_sanitize_text_alignment($input) { $valid = array('left', 'center', 'right'); if (in_array($input, $valid, true)) { return $input; } return 'left'; } function architecture_construction_menu_customizer_css() { ?> <style type="text/css"> .main-navigation ul li a { font-weight: <?php echo esc_html( get_theme_mod( 'menu_font_weight', '500' ) ); ?>; text-transform: <?php echo esc_html( get_theme_mod( 'menu_text_transform', 'capitalize' ) ); ?>; } </style> <?php } add_action( 'wp_head', 'architecture_construction_menu_customizer_css' ); // Sanitize Font Weight function architecture_construction_sanitize_font_weight( $value ) { $valid = array( '100', '200', '300', '400', '500', '600', '700', '800', '900' ); return in_array( $value, $valid ) ? $value : '400'; } // Sanitize Text Transform function architecture_construction_sanitize_text_transform( $value ) { $valid = array( 'none', 'capitalize', 'uppercase', 'lowercase' ); return in_array( $value, $valid ) ? $value : 'none'; } function architecture_construction_custom_blog_banner_title() { if (is_404()) { echo '<h1 class="entry-title">Page Not Found</h1>'; } elseif (is_search()) { echo '<h1 class="entry-title">Search Results for: ' . get_search_query() . '</h1>'; } elseif (is_home() && !is_front_page()) { echo '<h1 class="entry-title">Blogs</h1>'; } elseif (function_exists('is_shop') && is_shop()) { echo '<h1 class="entry-title">Shop</h1>'; } elseif (is_page_template('template-homepage.php')) { } elseif (is_page()) { the_title('<h1 class="entry-title">', '</h1>'); } elseif (is_single()) { the_title('<h1 class="entry-title">', '</h1>'); } elseif (is_archive()) { the_archive_title('<h1 class="entry-title">', '</h1>'); } else { the_archive_title('<h1 class="entry-title">', '</h1>'); } } function architecture_construction_body_classess( $classes ) { // Get the customizer setting value $hide_post_meta = get_theme_mod( 'architecture_construction_single_post_meta_setting', true ); // Check if the setting is set to hide if ( !$hide_post_meta ) { $classes[] = 'hide-post-meta'; } return $classes; } add_filter( 'body_class', 'architecture_construction_body_classess' ); function architecture_construction_hide_single_header_img() { ?> <script type="text/javascript"> document.addEventListener('DOMContentLoaded', function() { if (document.body.classList.contains('page-template-template-home')) { var headerImg = document.querySelector('.single-header-img'); if (headerImg) { headerImg.style.display = 'none'; } } }); </script> <?php } add_action('wp_footer', 'architecture_construction_hide_single_header_img');