当前位置: 首页>>代码示例>>PHP>>正文


PHP get_theme_option函数代码示例

本文整理汇总了PHP中get_theme_option函数的典型用法代码示例。如果您正苦于以下问题:PHP get_theme_option函数的具体用法?PHP get_theme_option怎么用?PHP get_theme_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_theme_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: register_taxonomies

 static function register_taxonomies()
 {
     $post_types = array('object');
     if (get_theme_option('enable_taxonomy')) {
         register_taxonomy('object_type', $post_types, array('hierarchical' => true, 'labels' => self::get_taxonomy_label(), 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug' => get_theme_option('taxonomy_url'))));
     }
 }
开发者ID:cabelotaina,项目名称:redelivre,代码行数:7,代码来源:objects.php

示例2: form

    function form($instance)
    {
        $sidebar = $instance['sidebar'];
        $sidebars = get_theme_option('general', 'sidebars');
        $sidebars = explode(';', $sidebars);
        if (count($sidebars) != 0) {
            ?>
        <p>
        	<label for="<?php 
            echo $this->get_field_id('sidebar');
            ?>
"><?php 
            _e('Sidebar', THEME_ADMIN_LANG_DOMAIN);
            ?>
</label>
        	<select name="<?php 
            echo $this->get_field_name('sidebar');
            ?>
" id="<?php 
            echo $this->get_field_id('sidebar');
            ?>
">
        	<?php 
            foreach ($sidebars as $sider) {
                $siderr = strtolower(str_replace(' ', '', $sider));
                echo '<option value="' . $siderr . '" ' . selected($sidebar, $siderr, false) . '>' . $sider . '</option>';
            }
            ?>
        	</select>
        </p>
        <?php 
        } else {
            echo '<p>' . __('you do not have any sidebars defined please define some in developer options page', THEME_ADMIN_LANG_DOMAIN) . '</p>';
        }
    }
开发者ID:shieldsdesignstudio,项目名称:forefield,代码行数:35,代码来源:the-sidebars.php

示例3: testConfigureThemeWithNoLogoFileAndNoPreviousLogoFile

 public function testConfigureThemeWithNoLogoFileAndNoPreviousLogoFile()
 {
     $themeName = self::THEME;
     $this->assertEquals('', (string) get_theme_option('logo', $themeName));
     // specify the files array for the post
     $_FILES = array('logo' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0), 'header_background' => array('name' => '', 'type' => '', 'tmp_name' => '', 'error' => 4, 'size' => 0));
     // specify the theme options for the post
     $themeOptions = array('display_featured_item' => '1', 'display_featured_collection' => '1', 'display_featured_exhibit' => '1', 'homepage_recent_items' => '', 'homepage_text' => '', 'footer_text' => '', 'display_footer_copyright' => '0');
     $csrf = new Zend_Form_Element_Hash('theme_config_csrf');
     $csrf->initCsrfToken();
     // specify other post data
     $otherPostData = array('hidden_file_logo' => '', 'hidden_file_header_background' => '', 'MAX_FILE_SIZE' => '33554432', 'submit' => 'Save Changes', 'theme_config_csrf' => $csrf->getHash());
     // set the the post data
     $post = array_merge($themeOptions, $otherPostData);
     $this->getRequest()->setParam('name', $themeName);
     $this->getRequest()->setPost($post);
     $this->getRequest()->setMethod('POST');
     // dispatch the controller action
     $this->dispatch('themes/config');
     $actualOptions = Theme::getOptions(self::THEME);
     $this->assertArrayNotHasKey('theme_config_csrf', $actualOptions);
     foreach ($themeOptions as $name => $value) {
         $this->assertArrayHasKey($name, $actualOptions);
         $this->assertEquals($actualOptions[$name], $value, "Option '{$name}' was not correctly set.");
     }
     // verify that logo is empty
     $this->assertEmpty(get_theme_option('logo', $themeName));
 }
开发者ID:emhoracek,项目名称:Omeka,代码行数:28,代码来源:ThemesControllerTest.php

示例4: dez_custom_google_font

function dez_custom_google_font()
{
    $safe_font = array("Arial", "Arial Black", "Verdana", "Tahoma", "Trebuchet MS", "Times New Roman", "Helvetica Neue", "Helvetica", "Lucida Grande", "Courier New", "Lucida Console", "Impact", "Georgia", "Palatino Linotype");
    $http = !empty($_SERVER['HTTPS']) ? "https" : "http";
    $un_bodytype = get_theme_option('body_font');
    $un_headtype = get_theme_option('headline_font');
    $un_navtype = get_theme_option('navigation_font');
    $bodytype = str_replace(' ', '+', get_theme_option('body_font'));
    $headtype = str_replace(' ', '+', get_theme_option('headline_font'));
    $navtype = str_replace(' ', '+', get_theme_option('navigation_font'));
    $font_var = '100,200,300,400,600,700,900,100italic,200italic,300italic,400italic,600italic,700italic,900italic';
    $font_subset = 'latin,cyrillic-ext,latin-ext,cyrillic,greek,greek-ext,vietnamese';
    if ($un_bodytype == "" || $un_bodytype == "Choose a font" || in_array($un_bodytype, $safe_font)) {
    } else {
        wp_register_style('body_gwf', $http . "://fonts.googleapis.com/css?family=" . $bodytype . ":" . $font_var . "&subset=" . $font_subset);
        wp_enqueue_style('body_gwf');
    }
    if ($un_headtype == "" || $un_headtype == "Choose a font" || in_array($un_headtype, $safe_font)) {
    } else {
        wp_register_style('headline_gwf', $http . "://fonts.googleapis.com/css?family=" . $headtype . ":" . $font_var . "&subset=" . $font_subset);
        wp_enqueue_style('headline_gwf');
    }
    if ($un_navtype == "" || $un_navtype == "Choose a font" || in_array($un_navtype, $safe_font)) {
    } else {
        wp_register_style('nav_gwf', $http . "://fonts.googleapis.com/css?family=" . $navtype . ":" . $font_var . "&subset=" . $font_subset);
        wp_enqueue_style('nav_gwf');
    }
}
开发者ID:jrbranaa,项目名称:pitchperspectives,代码行数:28,代码来源:fonts-functions.php

示例5: testWithThemeName

 public function testWithThemeName()
 {
     set_theme_option('logo', 'jammy.png', 'whatever');
     $this->assertEquals('jammy.png', get_theme_option('logo', 'whatever'));
     set_theme_option('new_option', 'hoohas', 'whatever');
     $this->assertEquals('hoohas', get_theme_option('new_option', 'whatever'));
 }
开发者ID:emhoracek,项目名称:Omeka,代码行数:7,代码来源:SetThemeOptionTest.php

示例6: mapasdevista_admin_init

function mapasdevista_admin_init()
{
    global $pagenow;
    if ($pagenow === "post.php" || $pagenow === "post-new.php" || isset($_GET['page']) && $_GET['page'] === "mapasdevista_maps") {
        wp_enqueue_script('jquery-ui-core');
        wp_enqueue_script('jquery-ui-resizable');
        wp_enqueue_script('jquery-ui-dialog');
        // api do google maps versao 3 direto
        $googleapikey = get_theme_option('google_key');
        $googleapikey = $googleapikey ? "&key={$googleapikey}" : '';
        wp_enqueue_script('google-maps-v3', 'http://maps.google.com/maps/api/js?sensor=false' . $googleapikey);
        wp_enqueue_script('openlayers', 'http://openlayers.org/api/OpenLayers.js');
        wp_enqueue_script('mapstraction', mapasdevista_get_baseurl() . '/js/mxn/mxn-min.js');
        wp_enqueue_script('mapstraction-core', mapasdevista_get_baseurl() . '/js/mxn/mxn.core-min.js');
        wp_enqueue_script('mapstraction-googlev3', mapasdevista_get_baseurl() . '/js/mxn/mxn.googlev3.core-min.js');
        wp_enqueue_script('mapstraction-openlayers', mapasdevista_get_baseurl() . '/js/mxn/mxn.openlayers.core-min.js');
    }
    if (isset($_GET['page']) && $_GET['page'] === "mapasdevista_theme_page") {
        wp_enqueue_script('jcolorpicker', mapasdevista_get_baseurl() . '/admin/colorpicker/js/colorpicker.js', array('jquery'));
        wp_enqueue_style('colorpicker', mapasdevista_get_baseurl() . '/admin/colorpicker/css/colorpicker.css');
        wp_enqueue_script('mapasdevista_theme_options', mapasdevista_get_baseurl() . '/admin/mapasdevista_theme_options.js', array('jquery', 'jcolorpicker'));
    }
    if ($pagenow === "post.php" || $pagenow === "post-new.php") {
        wp_enqueue_script('metabox', mapasdevista_get_baseurl() . '/admin/metabox.js');
    } elseif (isset($_GET['page']) && $_GET['page'] === 'mapasdevista_pins_page') {
        wp_enqueue_script('metabox', mapasdevista_get_baseurl() . '/admin/pins.js');
    }
    wp_enqueue_style('mapasdevista-admin', mapasdevista_get_baseurl('template_directory') . '/admin/admin.css');
}
开发者ID:Wikipraca,项目名称:Wikipraca-WikiSquare,代码行数:29,代码来源:functions.php

示例7: theme_options_validate_callback_function

/**
 * Faz a validação dos dados
 * 
 */
function theme_options_validate_callback_function($input)
{
    if (!empty($_FILES['logo']['name'])) {
        $allowed_file_types = array('jpg' => 'image/jpg', 'jpeg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png');
        if (!in_array($_FILES['logo']['type'], $allowed_file_types)) {
            wp_die(__('Sorry, this file type is not permitted for security reasons.'));
        }
        /*
         * O antigo wp_handle_upload( $_FILES[$field], array( 'test_form' => false ) ); foi substituído
         */
        $upload = media_handle_upload('logo', 0);
        if ($upload) {
            $input['logo'] = $upload;
        }
    } else {
        if (isset($_POST['restore-default-image']) && $_POST['restore-default-image'] == 1) {
            unset($input['logo']);
        } else {
            $logo = get_theme_option('logo');
            if (!empty($logo)) {
                $input['logo'] = get_theme_option('logo');
            }
        }
    }
    return $input;
}
开发者ID:aspto,项目名称:wordpress-themes,代码行数:30,代码来源:theme-options.php

示例8: get_theme_option_with_default

/**
 * Get a theme option wuith a default value
 *
 * @param string $option The theme option name
 * @param $def The default value if the option is not set
 * @param string|null $theme The theme name (defaults to the current theme)
 * @return string
 */
function get_theme_option_with_default($option, $def, $theme = null)
{
    $value = get_theme_option($option, $theme);
    if ($value == null || strlen($value) == 0) {
        $value = $def;
    }
    return $value;
}
开发者ID:charvolant,项目名称:bigstuff,代码行数:16,代码来源:functions.php

示例9: getHTML

 function getHTML()
 {
     if ($this->html != "") {
         return stripslashes($this->html);
     } else {
         return "<a " . (get_theme_option('redirect-banner-window') != "" ? "target=\"_blank\"" : "") . " title=\"" . $this->alt . "\"  href=\"" . $this->getLinkURL() . "\"><img class=\"bannerAd\" alt=\"" . $this->alt . "\" src=\"" . $this->image . "\" /></a>";
     }
 }
开发者ID:christocmp,项目名称:bingopaws,代码行数:8,代码来源:banner-manager.php

示例10: theme_option

/**
 * Output theme meta value
 *
 */
function theme_option($key, $default = '', $filter = '')
{
    $value = get_theme_option($key, $default);
    switch ($filter) {
        case 'wpautop':
            $value = wpautop($value);
            break;
    }
    echo $value;
}
开发者ID:Tolkera,项目名称:altheme,代码行数:14,代码来源:utils.php

示例11: get_unused_id_ajax

 function get_unused_id_ajax()
 {
     $lastid = get_theme_option("last_slide_id");
     if ($lastid < 3) {
         $lastid = 2;
     }
     $lastid++;
     echo esc_html($lastid);
     update_theme_option("last_slide_id", $lastid);
     die;
 }
开发者ID:vorcil,项目名称:adaptiveres,代码行数:11,代码来源:ajax-handlers.php

示例12: getReviewsRatingWordValue

 function getReviewsRatingWordValue($r, $words = '')
 {
     $maxLevel = max(5, (int) get_custom_option('reviews_max_level'));
     if (trim($words) == '') {
         $words = get_theme_option('reviews_criterias_levels');
     }
     $words = explode(',', $words);
     $k = $maxLevel / count($words);
     $r = max(0, min(count($words) - 1, floor($r / $k)));
     return isset($words[$r]) ? trim($words[$r]) : __('no rated', 'themerex');
 }
开发者ID:riaface,项目名称:GrowBeyond,代码行数:11,代码来源:type-reviews.php

示例13: widget

    /**
     * How to display the widget on the screen.
     */
    function widget($args, $instance)
    {
        extract($args);
        global $wp_query, $post;
        global $THEMEREX_CURRENT_SIDEBAR;
        /* Our variables from the widget settings. */
        $title = apply_filters('widget_title', isset($instance['title']) ? $instance['title'] : '');
        $number = isset($instance['number']) ? (int) $instance['number'] : '';
        $show_date = isset($instance['show_date']) ? (int) $instance['show_date'] : 0;
        $show_image = isset($instance['show_image']) ? (int) $instance['show_image'] : 0;
        $show_author = isset($instance['show_author']) ? (int) $instance['show_author'] : 0;
        $show_counters = isset($instance['show_counters']) ? (int) $instance['show_counters'] : 0;
        $category = isset($instance['category']) ? (int) $instance['category'] : 0;
        $show_counters = $show_counters ? get_theme_option("blog_counters") : '';
        $output = '';
        if ($THEMEREX_CURRENT_SIDEBAR == 'top') {
            $output .= '<div class="columnsWrap"><div class="columns1_2">';
        }
        $args = array('numberposts' => $number, 'offset' => 0, 'orderby' => 'post_date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => current_user_can('read_private_pages') && current_user_can('read_private_posts') ? array('publish', 'private') : 'publish', 'ignore_sticky_posts' => 1, 'suppress_filters' => true);
        if ($category > 0) {
            $args['category'] = $category;
        }
        $ex = get_theme_option('exclude_cats');
        if (!empty($ex)) {
            $args['category__not_in'] = explode(',', $ex);
        }
        $recent_posts = wp_get_recent_posts($args, OBJECT);
        $post_number = 0;
        foreach ($recent_posts as $post) {
            $post_number++;
            require themerex_get_file_dir('/templates/page-part-widgets-posts.php');
            if ($THEMEREX_CURRENT_SIDEBAR == 'top' && $post_number == round($number / 2)) {
                $output .= '
					</div><div class="columns1_2">
				';
            }
            if ($post_number >= $number) {
                break;
            }
        }
        if ($THEMEREX_CURRENT_SIDEBAR == 'top') {
            $output .= '</div></div>';
        }
        if (!empty($output)) {
            /* Before widget (defined by themes). */
            echo balanceTags($before_widget);
            /* Display the widget title if one was input (before and after defined by themes). */
            echo balanceTags($before_title) . esc_html($title) . balanceTags($after_title);
            echo balanceTags($output);
            /* After widget (defined by themes). */
            echo balanceTags($after_widget);
        }
    }
开发者ID:WestBayResidential,项目名称:wbrsorg,代码行数:56,代码来源:widget-recent-posts.php

示例14: tf_print_styles

function tf_print_styles()
{
    if (is_admin()) {
        return false;
    }
    wp_enqueue_style('base.css', THEME_CSS . '/base.css');
    if (get_theme_option('color_scheme') != 'orange') {
        wp_enqueue_style('skin', THEME_CSS . '/' . get_theme_option('color_scheme') . '.css');
    }
    wp_enqueue_style('skeleton.css', THEME_CSS . '/skeleton.css');
    wp_enqueue_style('prettyPhoto.css', THEME_CSS . '/prettyPhoto.css');
    wp_enqueue_style('responsive-grid.css', THEME_CSS . '/responsive-grid.css');
}
开发者ID:brycefrees,项目名称:nddLive,代码行数:13,代码来源:head.php

示例15: ultimatum_add_admin_submenus

function ultimatum_add_admin_submenus()
{
    $user = wp_get_current_user();
    add_submenu_page(THEME_SLUG, __('General Settings', THEME_LANG_DOMAIN), __('General Settings', THEME_LANG_DOMAIN), 'manage_options', THEME_SLUG, 'wonderworks_default');
    if (get_theme_option('general', 'ultimatum_seo')) {
        add_submenu_page(THEME_SLUG, __('SEO Options', THEME_LANG_DOMAIN), __('SEO Options', THEME_LANG_DOMAIN), 'manage_options', 'wonder-seo', 'seoDefaults');
    }
    add_submenu_page(THEME_SLUG, __('Font Library', THEME_LANG_DOMAIN), __('Font Library', THEME_LANG_DOMAIN), 'manage_options', 'wonder-fonts', 'fonts');
    add_submenu_page(THEME_SLUG, __('Templates', THEME_LANG_DOMAIN), __('Templates', THEME_LANG_DOMAIN), 'manage_options', 'wonder-themes', 'ultimatum_themes');
    add_submenu_page('wonder-themes', __('Layout Settings', THEME_LANG_DOMAIN), __('Layout Settings', THEME_LANG_DOMAIN), 'manage_options', 'wonder-layout', 'ultimatum_layouts', THEME_URI . '/wonderfoundry/images/ultimatum-icon.png');
    add_submenu_page('wonder-themes', __('CSS Editor', THEME_LANG_DOMAIN), __('CSS Editor', THEME_LANG_DOMAIN), 'manage_options', 'wonder-css', 'cssDefaults', THEME_URI . '/wonderfoundry/images/ultimatum-icon.png');
    add_submenu_page(THEME_SLUG, __('Custom Post Types', THEME_LANG_DOMAIN), __('Custom Post Types', THEME_LANG_DOMAIN), 'manage_options', 'wonder-types', 'PostTypes');
    add_submenu_page(THEME_SLUG, __('Updates', THEME_LANG_DOMAIN), __('Updates', THEME_LANG_DOMAIN), 'manage_options', 'wonder-update', 'wonder_update');
}
开发者ID:shieldsdesignstudio,项目名称:forefield,代码行数:14,代码来源:menus.php


注:本文中的get_theme_option函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。