function themify_config_init() { /* Set Error Reporting ***************************************************************************/ if (defined('WP_DEBUG') && WP_DEBUG) { error_reporting(E_ERROR | E_WARNING | E_PARSE); } else { error_reporting(E_ERROR); } /* Global Vars ***************************************************************************/ global $themify_config, $pagenow, $ThemifyConfig, $themify_gfonts; /* Activate Theme ***************************************************************************/ if (isset($_GET['activated']) && 'themes.php' == $pagenow) { themify_maybe_unset_image_script(); themify_maybe_clear_legacy(); header('Location: ' . admin_url() . 'admin.php?page=themify&firsttime=true'); } /* Theme Config ***************************************************************************/ define('THEMIFY_VERSION', '1.6.4'); /* Load Config from theme-config.php or custom-config.php ***************************************************************************/ $themify_config = $ThemifyConfig->get_config(); /* Google Fonts ***************************************************************************/ $themify_gfonts = themify_get_google_font_lists(); /* Woocommerce ***************************************************************************/ if (themify_is_woocommerce_active()) { add_theme_support('woocommerce'); } }
function themify_config_init() { /* Global Vars ***************************************************************************/ global $themify_config, $pagenow, $ThemifyConfig, $themify_gfonts; /* Activate Theme ***************************************************************************/ if (isset($_GET['activated']) && 'themes.php' == $pagenow) { themify_maybe_clear_legacy(); add_action('init', 'themify_theme_first_run', 20); } /* Theme Config ***************************************************************************/ define('THEMIFY_VERSION', '2.2.7'); /* Load Config from theme-config.php or custom-config.php ***************************************************************************/ $themify_config = $ThemifyConfig->get_config(); /* Google Fonts ***************************************************************************/ $themify_gfonts = themify_get_google_font_lists(); /* Run after update ***************************************************************************/ if ('update_ok' === get_option('themify_update_ok_flag')) { /** * Fires after the updater finished the updating process. * * @since 1.8.3 */ do_action('themify_updater_post_install'); } /* Woocommerce ***************************************************************************/ if (themify_is_woocommerce_active()) { add_theme_support('woocommerce'); } /** * Editor Style * @since 2.0.2 */ add_editor_style(); /** * Do not add custom background * @since 2.0.2 */ if (false) { add_theme_support('custom-background'); add_theme_support('custom-header'); } }
function themify_config_init() { /* Set Error Reporting ***************************************************************************/ if (defined('WP_DEBUG') && WP_DEBUG) { error_reporting(E_ERROR | E_WARNING | E_PARSE); } else { error_reporting(E_ERROR); } /* Global Vars ***************************************************************************/ global $themify_config, $pagenow, $ThemifyConfig, $themify_gfonts; /* Activate Theme ***************************************************************************/ if (isset($_GET['activated']) && 'themes.php' == $pagenow) { themify_maybe_clear_legacy(); add_action('init', 'themify_theme_first_run', 20); } /* Theme Config ***************************************************************************/ define('THEMIFY_VERSION', '1.9.9'); /* Load Config from theme-config.php or custom-config.php ***************************************************************************/ $themify_config = $ThemifyConfig->get_config(); /* Google Fonts ***************************************************************************/ $themify_gfonts = themify_get_google_font_lists(); /* Run after update ***************************************************************************/ if ('update_ok' === get_option('themify_update_ok_flag')) { /** * Fires after the updater finished the updating process. * * @since 1.8.3 */ do_action('themify_updater_post_install'); } /* Woocommerce ***************************************************************************/ if (themify_is_woocommerce_active()) { add_theme_support('woocommerce'); } }
public function register_default_hook_locations() { foreach (array(array('wp_head', 'wp_head', 'general'), array('wp_footer', 'wp_footer', 'general'), array('themify_body_start', 'body_start', 'layout'), array('themify_header_before', 'header_before', 'layout'), array('themify_header_start', 'header_start', 'layout'), array('themify_header_end', 'header_end', 'layout'), array('themify_header_after', 'header_after', 'layout'), array('themify_layout_before', 'layout_before', 'layout'), array('themify_content_before', 'content_before', 'layout'), array('themify_content_start', 'content_start', 'layout'), array('themify_post_before', 'post_before', 'post'), array('themify_post_start', 'post_start', 'post'), array('themify_before_post_image', 'before_post_image', 'post'), array('themify_after_post_image', 'after_post_image', 'post'), array('themify_before_post_title', 'before_post_title', 'post'), array('themify_after_post_title', 'after_post_title', 'post'), array('themify_post_end', 'post_end', 'post'), array('themify_post_after', 'post_after', 'post'), array('themify_comment_before', 'comment_before', 'comments'), array('themify_comment_start', 'comment_start', 'comments'), array('themify_comment_end', 'comment_end', 'comments'), array('themify_comment_after', 'comment_after', 'comments'), array('themify_content_end', 'content_end', 'layout'), array('themify_content_after', 'content_after', 'layout'), array('themify_sidebar_before', 'sidebar_before', 'layout'), array('themify_sidebar_start', 'sidebar_start', 'layout'), array('themify_sidebar_end', 'sidebar_end', 'layout'), array('themify_sidebar_after', 'sidebar_after', 'layout'), array('themify_layout_after', 'layout_after', 'layout'), array('themify_footer_before', 'footer_before', 'layout'), array('themify_footer_start', 'footer_start', 'layout'), array('themify_footer_end', 'footer_end', 'layout'), array('themify_footer_after', 'footer_after', 'layout'), array('themify_body_end', 'body_end', 'layout')) as $key => $value) { $this->register_location($value[0], $value[1], $value[2]); } /* register ecommerce hooks group only if current theme supports WooCommerce */ if (!themify_is_woocommerce_active()) { return; } foreach (array(array('themify_product_slider_add_to_cart_before', 'product_slider_add_to_cart_before', 'ecommerce'), array('themify_product_slider_add_to_cart_after', 'product_slider_add_to_cart_after', 'ecommerce'), array('themify_product_slider_image_start', 'product_slider_image_start', 'ecommerce'), array('themify_product_slider_image_end', 'product_slider_image_end', 'ecommerce'), array('themify_product_slider_title_start', 'product_slider_title_start', 'ecommerce'), array('themify_product_slider_title_end', 'product_slider_title_end', 'ecommerce'), array('themify_product_slider_price_start', 'product_slider_price_start', 'ecommerce'), array('themify_product_slider_price_end', 'product_slider_price_end', 'ecommerce'), array('themify_product_image_start', 'product_image_start', 'ecommerce'), array('themify_product_image_end', 'product_image_end', 'ecommerce'), array('themify_product_title_start', 'product_title_start', 'ecommerce'), array('themify_product_title_end', 'product_title_end', 'ecommerce'), array('themify_product_price_start', 'product_price_start', 'ecommerce'), array('themify_product_price_end', 'product_price_end', 'ecommerce'), array('themify_product_cart_image_start', 'product_cart_image_start', 'ecommerce'), array('themify_product_cart_image_end', 'product_cart_image_end', 'ecommerce'), array('themify_product_single_image_before', 'product_single_image_before', 'ecommerce'), array('themify_product_single_image_end', 'product_single_image_end', 'ecommerce'), array('themify_product_single_title_before', 'product_single_title_before', 'ecommerce'), array('themify_product_single_title_end', 'product_single_title_end', 'ecommerce'), array('themify_product_single_price_end', 'product_single_price_end', 'ecommerce'), array('themify_shopdock_before', 'shopdock_before', 'ecommerce'), array('themify_checkout_start', 'checkout_start', 'ecommerce'), array('themify_checkout_end', 'checkout_end', 'ecommerce'), array('themify_shopdock_end', 'shopdock_end', 'ecommerce'), array('themify_shopdock_after', 'shopdock_after', 'ecommerce'), array('themify_sorting_before', 'sorting_before', 'ecommerce'), array('themify_sorting_after', 'sorting_after', 'ecommerce'), array('themify_related_products_start', 'related_products_start', 'ecommerce'), array('themify_related_products_end', 'related_products_end', 'ecommerce'), array('themify_breadcrumb_before', 'breadcrumb_before', 'ecommerce'), array('themify_breadcrumb_after', 'breadcrumb_after', 'ecommerce'), array('themify_ecommerce_sidebar_before', 'ecommerce_sidebar_before', 'ecommerce'), array('themify_ecommerce_sidebar_after', 'ecommerce_sidebar_after', 'ecommerce')) as $key => $value) { $this->register_location($value[0], $value[1], $value[2]); } }
/** * Displays the data-bg and class attributes, including the background image and fullcover class * @param string $classes Additional CSS classes to output for this element */ function custom_header_background($classes = '') { $class = ''; $image = null; $repeat = ''; $data_bg = ''; $post_id = get_the_ID(); $nobg = ''; $back_key = 'styling-background-header_wrap_background-background_image-value-value'; $mode_key = 'styling-background-header_wrap_background-background_mode-value-value'; $nobg_key = 'styling-background-header_wrap_background-background_image-value-none'; $header_customizer = json_decode(get_theme_mod('headerwrap_background')); if (isset($header_customizer->src) && '' != $header_customizer->src) { $image = $header_customizer->src; $repeat = isset($header_customizer->style) ? $header_customizer->style : 'fullcover'; } elseif (themify_check($back_key)) { $image = themify_get($back_key); $repeat = themify_check($mode_key) ? themify_get($mode_key) : 'fullcover'; } $nobg = themify_get($nobg_key) || isset($header_customizer->noimage) && 'noimage' == $header_customizer->noimage; if (is_page() || is_singular('post') || is_singular('portfolio') || is_singular('highlight') || is_singular('team')) { global $themify; if (is_page()) { $post_id = $themify->page_id; } else { $post_id = get_the_ID(); } $image_meta = get_post_meta($post_id, 'background_image', true); if ($image_meta) { $image = $image_meta; $repeat_meta = get_post_meta($post_id, 'background_repeat', true); if ($repeat_meta) { $repeat = $repeat_meta; } } } if (themify_is_woocommerce_active() && is_shop()) { $post_id = get_option('woocommerce_shop_page_id'); $image_meta = get_post_meta($post_id, 'background_image', true); if ($image_meta) { $image = $image_meta; $repeat_meta = get_post_meta($post_id, 'background_repeat', true); if ($repeat_meta) { $repeat = $repeat_meta; } } } if ($gallery = get_post_meta($post_id, 'background_type', true) == 'slider' || get_post_meta($post_id, 'background_type', true) == '' && get_post_meta($post_id, 'background_gallery', true) != '') { $repeat = 'fullcover header-gallery'; } elseif ($nobg) { if (is_singular() && $image_meta) { $data_bg = "data-bg='{$image}'"; } else { $data_bg = ''; } } elseif ($image) { $data_bg = "data-bg='{$image}'"; } else { $data_bg = 'data-bg="http://themify.me/demo/themes/wp-content/uploads/2013/05/header.jpg"'; $repeat = 'fullcover'; } if ($video = get_post_meta($post_id, 'video_file', true)) { $data_bg .= " data-fullwidthvideo='{$video}'"; } if ($color = get_post_meta($post_id, 'background_color', true)) { $data_bg .= " data-bgcolor='{$color}'"; } if ($repeat || $classes) { $class = "class='{$repeat} {$classes}'"; } echo "{$data_bg} {$class}"; }
/** * Checks the area design setting and returns 'none' or a design option. * * @since 2.1.3 * * @param string $key Main prefix for setting and field. * @param array $args * * @return mixed */ function themify_area_design($key = 'header', $args = array()) { $args = wp_parse_args($args, array('setting' => 'setting-' . $key . '_design', 'field' => $key . '_design', 'default' => $key . '-horizontal', 'values' => array('header-horizontal', 'header-block', 'none'))); $is_shop = themify_is_woocommerce_active() && is_shop() ? true : false; if (is_singular() || $is_shop) { global $post; if ($is_shop && is_object($post)) { $temp_post = $post; $post = get_post(get_option('woocommerce_shop_page_id')); } $single = themify_get($args['field']); if ($is_shop && is_object($post)) { $post = $temp_post; } if (in_array($single, $args['values'])) { $design = $single; } } if (empty($design) || 'default' == $design) { $design = themify_check($args['setting']) ? themify_get($args['setting']) : $args['default']; } return $design; }
function get_bggallery_order() { $sc_order = false; if (themify_is_woocommerce_active() && is_shop()) { $gallery_raw = get_post_meta(get_option('woocommerce_shop_page_id'), 'background_gallery', true); } else { $gallery_raw = themify_get('background_gallery'); } if (strpos($gallery_raw, 'orderby') !== false) { $sc_order = preg_replace('#\\[gallery(.*)orderby="([a-zA-Z0-9]*)"(.*)\\]#i', '$2', $gallery_raw); } return $sc_order ? $sc_order : 'post__in'; }
/** * Set correct layout class in body for Shop page * * @since 1.9.4 * * @param array $classes * @return array */ function themify_wc_body_class($classes = array()) { // Check if WC is active and this is a WC-managed page if (!themify_is_woocommerce_active() || !function_exists('is_woocommerce') || !is_woocommerce()) { return $classes; } $sidebar_layout = ''; if (is_product()) { if (themify_check('setting-single_product_layout')) { $sidebar_layout = themify_get('setting-single_product_layout'); } elseif (themify_check('setting-default_page_post_layout')) { $sidebar_layout = themify_get('setting-default_page_post_layout'); } } else { global $wp_query; $sidebar_in_page = get_post_meta($wp_query->queried_object->ID, 'page_layout', true); if (isset($wp_query->queried_object) && isset($wp_query->queried_object->ID) && ($sidebar_in_page && 'default' != $sidebar_in_page)) { $sidebar_layout = $sidebar_in_page; } elseif (themify_check('setting-shop_layout')) { $sidebar_layout = themify_get('setting-shop_layout'); } elseif (themify_check('setting-default_layout')) { $sidebar_layout = themify_get('setting-default_layout'); } } if ('' != $sidebar_layout) { $key = 0; foreach ($classes as $class) { if (false !== stripos($class, 'sidebar')) { unset($classes[$key]); } $key++; } $classes[] = $sidebar_layout; } return $classes; }
/** * Add sidebar if it's enabled in theme settings * @since 1.4.6 */ function themify_wc_compatibility_sidebar() { // Check if WC is active and this is a WC-managed page if (!themify_is_woocommerce_active() || !is_woocommerce()) { return; } $sidebar_layout = 'sidebar1'; if (is_product()) { if (themify_check('setting-single_product_layout')) { $sidebar_layout = themify_get('setting-single_product_layout'); } elseif (themify_check('setting-default_page_post_layout')) { $sidebar_layout = themify_get('setting-default_page_post_layout'); } } else { if (themify_check('setting-shop_layout')) { $sidebar_layout = themify_get('setting-shop_layout'); } elseif (themify_check('setting-default_layout')) { $sidebar_layout = themify_get('setting-default_layout'); } } themify_ecommerce_sidebar_before(); // Hook if ($sidebar_layout != 'sidebar-none') { get_sidebar(); } themify_ecommerce_sidebar_after(); // Hook }