preview->is_preview_mode()
)
) {
if ( get_theme_mod( 'disable_elementor_dialog_js', 1 ) ) {
$scripts = wp_scripts();
if ( ! ( $scripts instanceof WP_Scripts ) ) {
return;
}
$handles_to_remove = [
'elementor-dialog',
];
$handles_updated = false;
foreach ( $scripts->registered as $dependency_object_id => $dependency_object ) {
if ( 'elementor-frontend' === $dependency_object_id ) {
if ( ! ( $dependency_object instanceof _WP_Dependency ) || empty( $dependency_object->deps ) ) {
return;
}
foreach ( $dependency_object->deps as $dep_key => $handle ) {
if ( in_array( $handle, $handles_to_remove ) ) { // phpcs:ignore
unset( $dependency_object->deps[ $dep_key ] );
$dependency_object->deps = array_values( $dependency_object->deps );
$handles_updated = true;
}
}
}
}
if ( $handles_updated ) {
wp_deregister_script( 'elementor-dialog' );
wp_dequeue_script( 'elementor-dialog' );
}
}
}
}
if ( get_theme_mod( 'disable_block_css', 0 ) ){
wp_deregister_style( 'wp-block-library' );
wp_deregister_style( 'wp-block-library-theme' );
wp_deregister_style( 'wc-block-style' );
wp_deregister_style( 'wc-blocks-vendors-style' );
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'wc-blocks-style' );
wp_dequeue_style( 'wc-blocks-editor-style' );
}
}
public function xstore_font_prefetch() {
$icons_type = ( etheme_get_option('bold_icons', 0) ) ? 'bold' : 'light';
if ( apply_filters('etheme_preload_woff_icons', true)) : ?>
= 2 || $page >= 2 ) && ! is_404() ) {
$title = "$title $sep " . sprintf( esc_html__( 'Page %s', 'xstore' ), max( $paged, $page ) );
}
return $title;
}
public function add_opengraph_doctype($output) {
$share_facebook = get_theme_mod('socials',array( 'share_twitter', 'share_facebook', 'share_vk', 'share_pinterest', 'share_mail', 'share_linkedin', 'share_whatsapp', 'share_skype'
));
if ( is_array($share_facebook) && in_array( 'share_facebook', $share_facebook ) ) {
// return $output . ' xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml"';
return $output . ' xmlns="http://www.w3.org/1999/xhtml" prefix="og: http://ogp.me/ns# fb: http://www.facebook.com/2008/fbml"';
} else {
return $output;
}
}
/**
* Returns the instance.
*
* @return object
* @since 8.3.6
*/
public static function get_instance( $shortcodes = array() ) {
if ( null == self::$instance ) {
self::$instance = new self( $shortcodes );
}
return self::$instance;
}
/**
* Add menu cache.
*
* @return string
* @since 9.1.1
* @version 1.0.1
*/
public function menu_cache($args, $id){
if (is_object($id) && isset($id->term_id) ) {
$id = $id->term_id;
}
$id = (string)$id;
$group = 'etheme_menu-cache';
$output = '';
if (
$id
&& get_theme_mod('menu_cache', 0)
// @todo make prevent menus from cache as option like ajaxify menus setting
&& !in_array($id, apply_filters('etheme_prevent_menus_from_cache', array()))
&& !in_array($id, get_theme_mod('menus_ajaxify', array()))
){
// local page cache
$output = wp_cache_get( $id, $group );
if (!$output || empty($output)){
// global object cache
$output = $this->menu_as_string($args, true);
wp_cache_set($id, $output, $group);
}
return $output;
} else {
$output = $this->menu_as_string($args);
if ($id){
wp_cache_delete($id, $group);
}
}
return $output;
}
/**
* Add menu object cache.
*
* @return string
* @since 9.1.1
* @version 1.0.0
*/
public function menu_as_string($args = array(), $cache = false){
if ($cache){
ob_start();
echo wp_nav_menu( $args );
return ob_get_clean();
} else {
return wp_nav_menu( $args );
}
}
}
$optimization = new XStore_Optimization();
$optimization->init();