Пример #1
0
 public function __construct()
 {
     $this->_sections = $this->get_sections();
     self::$_option_name = dt_get_theme_option_name();
     add_action('admin_init', array(&$this, 'admin_init'));
     add_action('admin_menu', array(&$this, 'admin_menu'));
     // Download theme option
     add_action("wp_ajax_dt_download_theme_option", array(&$this, "download_theme_option"));
 }
Пример #2
0
function dt_get_theme_option($option, $default = null)
{
    global $dt_theme_options;
    if (empty($option)) {
        return $default;
    }
    $_option_name = dt_get_theme_option_name();
    if (empty($dt_theme_options)) {
        $dt_theme_options = get_option($_option_name);
    }
    if (is_page() || defined('WOOCOMMERCE_VERSION') && is_woocommerce()) {
        if ($option == 'header-style') {
            $page_value = dt_get_post_meta('header_style');
            if ($page_value !== null && $page_value !== array() && $page_value !== false && $page_value != '-1') {
                return apply_filters('dt_get_theme_option', $page_value, $option);
            }
        }
        if ($option == 'show-topbar') {
            $page_value = dt_get_post_meta('show_topbar');
            if ($page_value !== null && $page_value !== array() && $page_value !== false && $page_value != '-1') {
                return apply_filters('dt_get_theme_option', $page_value, $option);
            }
        }
        if ($option == 'menu-transparent') {
            $page_value = dt_get_post_meta('menu_transparent');
            if ($page_value !== null && $page_value !== array() && $page_value !== false && $page_value != '-1') {
                return apply_filters('dt_get_theme_option', $page_value, $option);
            }
        }
        if ($option == 'footer-area') {
            $page_value = dt_get_post_meta('footer_area');
            if ($page_value !== null && $page_value !== array() && $page_value !== false && $page_value != '-1') {
                return apply_filters('dt_get_theme_option', $page_value, $option);
            }
        }
        if ($option == 'footer-menu') {
            $page_value = dt_get_post_meta('footer_menu');
            if ($page_value !== null && $page_value !== array() && $page_value !== false && $page_value != '-1') {
                return apply_filters('dt_get_theme_option', $page_value, $option);
            }
        }
    }
    if (isset($dt_theme_options[$option]) && $dt_theme_options[$option] !== '' && $dt_theme_options[$option] !== null && $dt_theme_options[$option] !== array() && $dt_theme_options[$option] !== false) {
        $value = $dt_theme_options[$option];
        return apply_filters('dt_get_theme_option', $value, $option);
    } else {
        return $default;
    }
}