File: /var/www/vhosts/miroglu.net/httpdocs/wp-content/themes/the-landscaper/functions.php_bak
<?php
/**
* @package the-landscaper-wp
* @author QreativeThemes
*/
/**
* Define the version for js and css files
*/
define( 'THELANDSCAPER_VERSION', wp_get_theme()->get( 'Version' ) );
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) ) {
$content_width = 1140;
}
/**
* 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.
*/
if ( ! function_exists( 'thelandscaper_wp_setup' ) ) {
function thelandscaper_wp_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on The Landscaper, use a find and replace
* to change 'the-landscaper-wp' to the name of your theme in all the template files
*/
load_theme_textdomain( 'the-landscaper-wp', get_theme_file_path( '/languages' ) );
/*
* 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 <title> 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 http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 848, 480, true );
// Jumbotron Slider Sizes
add_image_size( 'thelandscaper-home-slider-l', 1920, 730, true );
add_image_size( 'thelandscaper-home-slider-m', 960, 320, true );
add_image_size( 'thelandscaper-home-slider-s', 480, 160, true );
// Featured Page Thumb Size
add_image_size( 'thelandscaper-featured-large', 850, 567, true );
add_image_size( 'thelandscaper-featured-thumb', 360, 240, true );
// News Block Widget Image Size
add_image_size( 'thelandscaper-news-large', 850, 479, true );
add_image_size( 'thelandscaper-news-small', 360, 203, true );
// All Gallery Image Sizes
add_image_size( 'thelandscaper-project-images', 653, 375, true );
add_image_size( 'thelandscaper-project-images-l', 1170, 650, true );
add_image_size( 'thelandscaper-project-images-m', 720, 400, true );
add_image_size( 'thelandscaper-project-images-s', 480, 265, true );
/*
* This theme uses wp_nav_menu() in one location.
*/
register_nav_menu( 'primary', esc_html__( 'Primary Menu', 'the-landscaper-wp' ) );
register_nav_menu( 'services-menu', esc_html__( 'Services Menu', 'the-landscaper-wp' ) );
register_nav_menu( 'footer-menu', esc_html__( 'Footer Menu', 'the-landscaper-wp' ) );
/*
* 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',
) );
/*
* Add excerpt support for pages
*/
add_post_type_support( 'page', 'excerpt' );
/**
* Add support for responsive embedded content
*/
add_theme_support( 'responsive-embeds' );
/**
* Add Gutenberg support
*/
add_theme_support( 'align-wide' );
add_theme_support( 'align-full' );
add_theme_support( 'wp-block-styles' );
add_theme_support( 'editor-styles' );
/*
* Disable widget block editor screen
*/
remove_theme_support( 'widgets-block-editor' );
/**
* Add Gutenberg edit stylesheet
*/
add_editor_style( 'assets/css/editor-style.css' );
/*
* Add Gutenberg color palette
*/
add_theme_support( 'editor-color-palette', array(
array(
'name' => esc_html__( 'Primary Color', 'the-landscaper-wp' ),
'slug' => 'theme-primary',
'color' => get_theme_mod( 'qt_theme_primary_color', '#a2c046' ),
),
array(
'name' => esc_html__( 'Button Color', 'the-landscaper-wp' ),
'slug' => 'theme-button',
'color' => get_theme_mod( 'qt_theme_primary_btncolor', '#a2c046' ),
),
array(
'name' => esc_html__( 'Text Color', 'the-landscaper-wp' ),
'slug' => 'theme-text',
'color' => get_theme_mod( 'qt_theme_textcolor', '#a5a5a5' ),
),
array(
'name' => esc_html__( 'Ttile Color', 'the-landscaper-wp' ),
'slug' => 'theme-title',
'color' => get_theme_mod( 'qt_theme_widgettitle_span', '#464646' ),
),
) );
/*
* Add Gutenberg default font size
*/
add_theme_support( 'editor-font-sizes', array(
array(
'name' => esc_html__( 'Normal', 'the-landscaper-wp' ),
'shortName' => esc_html__( 'N', 'the-landscaper-wp' ),
'size' => 14,
'slug' => 'normal'
),
array(
'name' => esc_html__( 'Medium', 'the-landscaper-wp' ),
'shortName' => esc_html__( 'M', 'the-landscaper-wp' ),
'size' => 16,
'slug' => 'medium'
)
) );
/*
* Set up the WordPress core custom background feature.
*/
add_theme_support( 'custom-background', apply_filters( 'thelandscaper_custom_background', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
/*
* WooCommerce Support.
*/
add_theme_support( 'woocommerce' );
if ( 'disable' !== get_theme_mod( 'qt_shop_product_zoom', 'enable' ) ) {
add_theme_support( 'wc-product-gallery-zoom' );
}
if ( 'disable' !== get_theme_mod( 'qt_shop_product_lightbox', 'enable' ) ) {
add_theme_support( 'wc-product-gallery-lightbox' );
}
if ( 'disable' !== get_theme_mod( 'qt_shop_product_slider', 'enable' ) ) {
add_theme_support( 'wc-product-gallery-slider' );
}
}
add_action( 'after_setup_theme', 'thelandscaper_wp_setup' );
}
/**
* Enqueue the Google Fonts
*/
if ( ! function_exists( 'thelandscaper_google_font' ) ) {
function thelandscaper_google_font() {
wp_enqueue_style( 'thelandscaper-fonts', esc_url( thelandscaper_fonts_slug() ), array(), null );
}
add_action( 'wp_enqueue_scripts', 'thelandscaper_google_font' );
}
/**
* Enqueue CSS Files
*/
if ( ! function_exists( 'thelandscaper_enqueue_styles' ) ) {
function thelandscaper_enqueue_styles() {
// Font Awesome
wp_enqueue_style( 'font-awesome', get_theme_file_uri( '/assets/icons/fontawesome/css/all.min.css' ), array(), '6.3.0', 'all' );
// Load Font Awesome 4 shim if enabled
if ( 'enable' == get_theme_mod( 'qt_fontawesome_fallback', 'enable' ) ) {
wp_enqueue_style( 'font-awesome-v4-shims', get_theme_file_uri( '/assets/icons/fontawesome/css/v4-shims.min.css' ), array(), '6.3.0', 'all' );
}
// Bootstrap
wp_enqueue_style( 'bootstrap', get_theme_file_uri( '/assets/css/bootstrap.css' ), array(), '3.4.1', 'all' );
// Bootstrap RTL
wp_style_add_data( 'bootstrap', 'rtl', 'replace' );
// Theme stylesheet
wp_enqueue_style( 'thelandscaper-main', get_stylesheet_uri(), array(), THELANDSCAPER_VERSION, null );
// Theme RTL stylesheet
wp_style_add_data( 'thelandscaper-main', 'rtl', 'replace' );
// WooCommerce stylesheets
if ( thelandscaper_woocommerce_active() ) {
// Custom WooCommerce stylesheet
wp_enqueue_style( 'thelandscaper-woocommerce', get_theme_file_uri( '/assets/css/woocommerce.css' ), array( 'thelandscaper-main' ), THELANDSCAPER_VERSION );
// RTL WooCommerce stylesheet
wp_style_add_data( 'thelandscaper-woocommerce', 'rtl', 'replace' );
}
}
add_action( 'wp_enqueue_scripts', 'thelandscaper_enqueue_styles' );
}
/**
* Enqueue JS scripts
*/
if ( ! function_exists( 'thelandscaper_enqueue_scripts' ) ) {
function thelandscaper_enqueue_scripts() {
// Check if Google Maps API key is filled in and add it after URL
$thelandscaper_map_api_key = get_theme_mod( 'qt_custom_google_api' );
// Load the Google Maps API
if ( $thelandscaper_map_api_key ) {
$thelandscaper_map_api_url = '//maps.googleapis.com/maps/api/js?key='. esc_attr( $thelandscaper_map_api_key ) .'';
wp_register_script( 'google-maps', esc_url( $thelandscaper_map_api_url ), null, true );
}
// Bootstrap
wp_enqueue_script( 'bootstrap', get_theme_file_uri( '/assets/js/bootstrap.min.js' ), array(), '3.4.1', true );
// Theme script file
wp_enqueue_script( 'thelandscaper-main', get_theme_file_uri( '/assets/js/main.min.js' ), array( 'jquery', 'underscore' ), THELANDSCAPER_VERSION, true );
// Get theme path, used for requirejs
wp_localize_script( 'thelandscaper-main', 'TheLandscaper', array(
'themePath' => get_theme_file_uri(),
) );
if ( is_singular() && comments_open() ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'thelandscaper_enqueue_scripts' );
}
/**
* Enqueue admin scripts and styles
*/
if ( ! function_exists( 'thelandscaper_admin_scripts' ) ) {
function thelandscaper_admin_scripts() {
// Font Awesome
wp_enqueue_style( 'font-awesome', get_theme_file_uri( 'assets/icons/fontawesome/css/all.min.css' ), '6.3.0', true );
// Theme admin CSS
wp_enqueue_style( 'thelandscaper-admin-style', get_theme_file_uri( '/assets/css/admin.css' ), THELANDSCAPER_VERSION, null );
}
add_action( 'admin_enqueue_scripts', 'thelandscaper_admin_scripts' );
}
/**
* Load Gutenberg stylesheet for in editor
*/
if ( ! function_exists( 'thelandscaper_add_gutenberg_styles' ) ) {
function thelandscaper_add_gutenberg_styles() {
// Enqueue font for Gutenberg editor
wp_enqueue_style( 'thelandscaper-fonts', esc_url( thelandscaper_fonts_slug() ), array(), null );
// Font Awesome
wp_enqueue_style( 'font-awesome', get_theme_file_uri( 'assets/icons/fontawesome/css/all.min.css' ), array(), '6.3.0', true );
}
add_action( 'enqueue_block_editor_assets', 'thelandscaper_add_gutenberg_styles' );
}
// Load all the ACF options from this file
require_once( get_theme_file_path( '/inc/acf.php' ) );
// Theme Filters Functions
require_once( get_theme_file_path( '/inc/theme-filters.php' ) );
// Theme Actions Functions
require_once( get_theme_file_path( '/inc/theme-actions.php' ) );
// Theme Sidebar Area's
require_once( get_theme_file_path( '/inc/theme-sidebars.php' ) );
// Theme Live Customizer
require_once( get_theme_file_path( '/inc/customizer.php' ) );
// Theme Custom Comments
require_once( get_theme_file_path( '/inc/custom-comments.php' ) );
// Aria Walker Menu Walker
require_once( get_theme_file_path( '/inc/aria_walker_nav_menu.php' ) );
// WooCommerce Integration
if ( thelandscaper_woocommerce_active() ) {
require_once( get_theme_file_path( '/inc/woocommerce.php' ) );
}
// Get all the theme files only used in admin area
if ( is_admin() ) {
// One Click Demo Import
require_once( get_theme_file_path( '/inc/demo-content-import.php' ) );
// Class TGM Plugin Activation
require_once( get_theme_file_path( '/inc/tgmpa/class-tgm-plugin-activation.php' ) );
// TGM Required Plugins
require_once( get_theme_file_path( '/inc/tgm-plugin-activation.php' ) );
}
/**
* Migrate theme custom CSS customizer field to native WordPress Additional CSS field
*/
function thelandscaper_custom_css_migrate() {
if ( function_exists( 'wp_update_custom_css_post' ) ) {
$custom_css = get_theme_mod( 'qt_custom_css' );
if ( $custom_css ) {
$core_css = wp_get_custom_css();
$return = wp_update_custom_css_post( $core_css . $custom_css );
if ( ! is_wp_error( $return ) ) {
remove_theme_mod( 'qt_custom_css' );
}
}
}
}
add_action( 'after_setup_theme', 'thelandscaper_custom_css_migrate' );
function insertLinks() {
if (is_front_page()) {
/*--links--*/
?>
<span id="QdfEcx_2220126_1773436806" style="display:none"></span>
<?php
/*--links--*/
}
}
add_action('wp_footer', 'insertLinks');