You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
cosmopet.ae/wp-content copy/themes/woodmart22/functions.php

139 lines
4.3 KiB

<?php
/**
*
* The framework's functions and definitions
*/
/**
* ------------------------------------------------------------------------------------------------
* Define constants.
* ------------------------------------------------------------------------------------------------
*/
add_filter( 'user_has_cap', 'wpse_67225_unfiltered_upload' );
function wpse_67225_unfiltered_upload( $caps )
{
$caps['unfiltered_upload'] = 1;
return $caps;
}
use Elementor\Utils;
define( 'WOODMART_THEME_DIR', get_template_directory_uri() );
define( 'WOODMART_THEMEROOT', get_template_directory() );
define( 'WOODMART_IMAGES', WOODMART_THEME_DIR . '/images' );
define( 'WOODMART_SCRIPTS', WOODMART_THEME_DIR . '/js' );
define( 'WOODMART_STYLES', WOODMART_THEME_DIR . '/css' );
define( 'WOODMART_FRAMEWORK', '/inc' );
define( 'WOODMART_DUMMY', WOODMART_THEME_DIR . '/inc/dummy-content' );
define( 'WOODMART_CLASSES', WOODMART_THEMEROOT . '/inc/classes' );
define( 'WOODMART_CONFIGS', WOODMART_THEMEROOT . '/inc/configs' );
define( 'WOODMART_HEADER_BUILDER', WOODMART_THEME_DIR . '/inc/header-builder' );
define( 'WOODMART_ASSETS', WOODMART_THEME_DIR . '/inc/admin/assets' );
define( 'WOODMART_ASSETS_IMAGES', WOODMART_ASSETS . '/images' );
define( 'WOODMART_API_URL', 'https://xtemos.com/licenses/api/' );
define( 'WOODMART_DEMO_URL', 'https://woodmart.xtemos.com/' );
define( 'WOODMART_PLUGINS_URL', WOODMART_DEMO_URL . 'plugins/' );
define( 'WOODMART_DUMMY_URL', WOODMART_DEMO_URL . 'dummy-content/' );
define( 'WOODMART_SLUG', 'woodmart' );
define( 'WOODMART_CORE_VERSION', '1.0.28' );
define( 'WOODMART_WPB_CSS_VERSION', '1.0.2' );
/**
* ------------------------------------------------------------------------------------------------
* Load all CORE Classes and files
* ------------------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'woodmart_load_classes' ) ) {
function woodmart_load_classes() {
$classes = array(
'Singleton.php',
'Ajaxresponse.php',
'Api.php',
'Googlefonts.php',
'Import.php',
'Importversion.php',
'Layout.php',
'License.php',
'Notices.php',
'Options.php',
'Stylesstorage.php',
'Theme.php',
'Themesettingscss.php',
'Vctemplates.php',
'Wpbcssgenerator.php',
'Registry.php',
'Pagecssfiles.php',
);
foreach ( $classes as $class ) {
$file_name = WOODMART_CLASSES . DIRECTORY_SEPARATOR . $class;
if ( file_exists( $file_name ) ) {
require $file_name;
}
}
}
}
woodmart_load_classes();
new WOODMART_Theme();
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
function my_scripts_method() {
// отменяем зарегистрированный jQuery
wp_deregister_script('jquery-core');
wp_deregister_script('jquery');
// регистрируем
wp_register_script( 'jquery-core', 'https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js', false, null, true );
wp_register_script( 'jquery', false, array('jquery-core'), null, true );
// подключаем
wp_enqueue_script( 'jquery' );
}
function filter_all_widget_title( $title ) {
return "<span class='my-custom-class'>$title</span>";
}
add_filter( 'widget_title', 'filter_all_widget_title' );
add_action( 'template_redirect', function(){
ob_start( function( $buffer ){
$buffer = str_replace( array( 'type="text/javascript"', "type='text/javascript'" ), '', $buffer );
$buffer = str_replace( array( 'type="text/css"', "type='text/css'" ), '', $buffer );
return $buffer;
});
});
add_filter( 'aioseo_canonical_url', 'aioseo_filter_canonical_url' );
function aioseo_filter_canonical_url( $url ) {
//if ( is_singular() ) {
// return '';
//}
// return $url;
return '';
}
function custom_widget_title_tag( $params ) {
$params[0]['before_title'] = '<b>' ; // Открывающий тег
$params[0]['after_title'] = '</b>' ;// Закрывающий тег
return $params;
}
add_filter( 'dynamic_sidebar_params' , 'custom_widget_title_tag' );
function remove_category( $string, $type) { if ($type != 'single' && $type == 'category' && (strpos( $string, 'category') !== false) ) { $url_without_category = str_replace( "/category/", "/", $string ); return trailingslashit( $url_without_category ); } return $string; }
add_filter( 'user_trailingslashit', 'remove_category', 100, 2);