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( 'construc-recent-thumn', 65, 65, true ); add_image_size( 'construc-thumbnail', 370, 230, true ); add_image_size( 'construc-project', 380, 280, true ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'menu-1' => esc_html__( 'Primary', 'construc' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ $html5args = array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ); add_theme_support( 'html5', $html5args ); // Set up the WordPress core custom background feature. $custombgargs = apply_filters( 'construc_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ); add_theme_support( 'custom-background', $custombgargs ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); add_editor_style( 'asset/css/bootstrap.css' ); /** * Add support for core custom logo. * * @link https://codex.wordpress.org/Theme_Logo */ $customlogo = array( 'height' => 250, 'width' => 250, 'flex-width' => true, 'flex-height' => true, ); add_theme_support( 'custom-logo', $customlogo ); add_post_type_support( 'page', 'excerpt' ); } endif; add_action( 'after_setup_theme', 'construc_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 construc_content_width() { // This variable is intended to be overruled from themes. // Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}. // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound $GLOBALS['content_width'] = apply_filters( 'construc_content_width', 640 ); } add_action( 'after_setup_theme', 'construc_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ require get_template_directory() . '/inc/register-sidebar.php'; /** * All css and js files */ require get_template_directory() . '/inc/scripts-files.php'; /** * Implement the Custom Header feature. */ require get_template_directory() . '/inc/custom-header.php'; /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Functions which enhance the theme by hooking into WordPress. */ require get_template_directory() . '/inc/template-functions.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Comment Form Templtae */ require get_template_directory() . '/inc/comment-form.php'; /** * Latest Post Widget */ require get_template_directory() . '/inc/widget/class-construc-latest-post.php'; /** * Load Jetpack compatibility file. */ if ( defined( 'JETPACK__VERSION' ) ) { require get_template_directory() . '/inc/jetpack.php'; } if ( ! function_exists( 'construc_fonts_url' ) ) : /** * * Fonts Function URL */ function construc_fonts_url() { $fonts_url = ''; $fonts = array(); $subsets = 'latin'; if ( 'off' !== _x( 'on', 'Open Sans font: on or off', 'construc' ) ) { $fonts[] = 'Open+Sans:300,400,600,700'; } if ( 'off' !== _x( 'on', 'Oxygen font: on or off', 'construc' ) ) { $fonts[] = 'Oxygen:300,400,700'; } if ( 'off' !== _x( 'on', 'Ubuntu font: on or off', 'construc' ) ) { $fonts[] = 'Ubuntu:400,500,700'; } if ( $fonts ) { $fonts_url = add_query_arg( array( 'family' => urlencode( implode( '|', $fonts ) ), 'subset' => urlencode( $subsets ), ), 'https://fonts.googleapis.com/css' ); } $fonts_url = str_replace( 'Open%2BSans', 'Open+Sans', $fonts_url ); return $fonts_url; } endif; function construc_sanitize_checkbox( $checked ) { // returns true if checkbox is checked return ( ( isset( $checked ) && true == $checked ) ? true : false ); } function construc_services_one_switch() { if ( true == get_theme_mod( 'services_1_switch' ) ) { return true; } return false; } function construc_services_two_switch() { if ( true == get_theme_mod( 'services_2_switch' ) ) { return true; } return false; } function construc_services_three_switch() { if ( true == get_theme_mod( 'services_3_switch' ) ) { return true; } return false; } function construc_services_four_switch() { if ( true == get_theme_mod( 'services_4_switch' ) ) { return true; } return false; } function construc_services_five_switch() { if ( true == get_theme_mod( 'services_5_switch' ) ) { return true; } return false; } function construc_services_six_switch() { if ( true == get_theme_mod( 'services_6_switch' ) ) { return true; } return false; } function construc_services_section_title_switch() { if ( true == get_theme_mod( 'services_section_title_switch' ) ) { return true; } return false; } function construc_blog_section_title_switch() { if ( true == get_theme_mod( 'blog_section_title_switch' ) ) { return true; } return false; } function construc_slider_two_on() { if ( true == get_theme_mod( 'slider_two_on_off' ) ) { return true; } return false; } function construc_slider_three_on() { if ( true == get_theme_mod( 'slider_three_on_off' ) ) { return true; } return false; } function construc_topbar_on_off() { if ( true == get_theme_mod( 'topbar_on_off' ) ) { return true; } return false; } function construc_sanitize_radio( $input, $setting ) { $input = sanitize_key( $input ); $choices = $setting->manager->get_control( $setting->id )->choices; return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } function construc_sanitize_select( $input, $setting ) { $input = sanitize_key( $input ); $choices = $setting->manager->get_control( $setting->id )->choices; return ( array_key_exists( $input, $choices ) ? $input : $setting->default ); } function construc_is_blog() { return ( is_archive() || is_author() || is_category() || is_home() || is_single() || is_tag() ) && 'post' == get_post_type(); } function construc_sanitize_dropdown_pages( $page_id, $setting ) { // Ensure $input is an absolute integer. $page_id = absint( $page_id ); // If $page_id is an ID of a published page, return it; otherwise, return the default. return ( 'publish' == get_post_status( $page_id ) ? $page_id : $setting->default ); } function construc_fron_page_template(){ if (is_page_template( 'frontpage.php' )) { return true; } return false; }