本文整理汇总了PHP中ot_get_option函数的典型用法代码示例。如果您正苦于以下问题:PHP ot_get_option函数的具体用法?PHP ot_get_option怎么用?PHP ot_get_option使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ot_get_option函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getShortlink
/**
* Return a shortlink for a post, page, attachment, or blog.
*
* @since 1.0.0
*/
public function getShortlink($shortlink, $id, $context, $allow_slugs)
{
if (ot_get_option('bitly_service_active') == 'no') {
return false;
}
if (is_singular() && is_preview()) {
return false;
}
global $wp_query;
$post_id = '';
if ('query' == $context && is_singular()) {
$post_id = $wp_query->get_queried_object_id();
} else {
if ('post' == $context) {
$post = get_post($id);
$post_id = $post->ID;
}
}
if ($shortlink = get_metadata('post', $post_id, '_bitly_shortlink', true)) {
return $shortlink;
}
if (is_front_page() && !is_paged()) {
return apply_filters('bitly_front_page', false);
}
$url = get_permalink($post_id);
$domain = ot_get_option('bitly_domain');
$this->login(ot_get_option('bitly_login'));
$this->apiKey(ot_get_option('bitly_api_key'));
$shortlink = $this->shorten($url, $domain);
if (!empty($shortlink)) {
update_metadata('post', $post_id, '_bitly_shortlink', $shortlink);
return $shortlink;
}
return false;
}
示例2: save_images
function save_images($image_url, $post_id, $i)
{
//set_time_limit(180); //每个图片最长允许下载时间,秒
$file = file_get_contents($image_url);
$fileext = substr(strrchr($image_url, '.'), 1);
$fileext = strtolower($fileext);
if ($fileext == "" || strlen($fileext) > 4) {
$fileext = "jpg";
}
$savefiletype = array('jpg', 'gif', 'png', 'bmp');
if (!in_array($fileext, $savefiletype)) {
$fileext = "jpg";
}
$im_name = date('YmdHis', time()) . $i . mt_rand(10, 20) . '.' . $fileext;
$res = wp_upload_bits($im_name, '', $file);
if (isset($res['file'])) {
$attach_id = insert_attachment($res['file'], $post_id);
} else {
return;
}
if (ot_get_option('auto_save_image_thumb') == 'on' && $i == 1) {
set_post_thumbnail($post_id, $attach_id);
}
return $res;
}
示例3: coll_enqueue_styles
function coll_enqueue_styles()
{
global $coll_is_mobile;
if (!$coll_is_mobile) {
wp_register_style('scrollbar', get_template_directory_uri() . '/css/perfect-scrollbar.css');
wp_enqueue_style('scrollbar');
}
wp_register_style('googlefonts', '//fonts.googleapis.com/css?family=Bentham|Pinyon+Script|Bitter:400,700|Raleway:300,400,500,600|Sacramento|Lato:300,400,900|Open+Sans:400,700,800|Pacifico|Lobster|Roboto:400,900,700|Oswald:400,700');
wp_register_style('normalize', get_template_directory_uri() . '/css/normalize.css');
wp_register_style('foundation', get_template_directory_uri() . '/css/foundation.css', null, null);
wp_register_style('magicpopup', get_template_directory_uri() . '/css/magnific-popup.css');
wp_register_style('icons', get_template_directory_uri() . '/css/font-awesome.min.css');
wp_register_style('superfish', get_template_directory_uri() . '/css/superfish.css');
wp_register_style('flexslider', get_template_directory_uri() . '/css/flexslider.css', null, null);
wp_register_style('plugin', get_template_directory_uri() . '/css/plugin.css', null, null);
wp_register_style('public', get_template_directory_uri() . '/css/public.css', null, null);
wp_register_style('morpheus', get_stylesheet_uri(), null, null);
wp_enqueue_style('googlefonts');
wp_enqueue_style('foundation');
wp_enqueue_style('magicpopup');
wp_enqueue_style('icons');
wp_enqueue_style('superfish');
wp_enqueue_style('flexslider');
wp_enqueue_style('plugin');
wp_enqueue_style('public');
wp_enqueue_style('morpheus');
// add custom css
$custom_css = ot_get_option('coll_custom_css');
if (!empty($custom_css)) {
wp_add_inline_style('morpheus', $custom_css);
}
}
示例4: widget
function widget($args, $modulos)
{
extract($args);
/* Tags dos elementos do Widget */
$title = apply_filters('widget_title', $modulos['title']);
$SuasVariaveis = $modulos['SuasVariaveis'];
/* Front End do Widget. */
echo $front_widget;
/* Função para exibição do título */
if ($title) {
echo $before_title . $title . $after_title;
}
/* Exibição dos elementos no Front */
$logoOption = ot_get_option('logotipo');
$blogName = get_bloginfo('name');
$extra_classee = '';
if ($title) {
$extra_classe = 'nome da nova classe';
}
?>
<!-- Aqui sua brincadeira de Front End começa -->
<div class="classe-widget">
</div>
<?php
/* Back End do Widget. */
echo $back_widget;
}
示例5: fun_wp_footer
function fun_wp_footer()
{
echo '
<script type="text/javascript" src="' . THEME_URI . '/js/jquery.min.js"></script>
<script type="text/javascript" src="' . THEME_URI . '/js/scripts.js"></script>
';
if (is_home() && ot_get_option('opt_slider') == 'on') {
?>
<script type="text/javascript">
eval(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,String)){while(c--)d[c]=k[c]||c;k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('$(4).3(2(){$(\'#1\').0()});',5,5,'nivoSlider|slider|function|load|window'.split('|'),0,{}))
</script>
<?php
}
if (ot_get_option('opt_share')) {
?>
<script type="text/javascript">
window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"1","bdSize":"24"},"share":{},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["qzone","tsina","tqq","renren","weixin","douban"]}};
with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
</script>
<?php
}
if (is_single()) {
?>
<script type="text/javascript" src="<?php
bloginfo('template_directory');
?>
/js/comments-ajax.js"></script>
<?php
}
}
示例6: member
function member()
{
$member_slug = function_exists('ot_get_option') ? ot_get_option('member_slug', 'member') : 'member';
$labels = array('name' => __('Member', 'cactusthemes'), 'singular_name' => __('Member', 'cactusthemes'), 'add_new' => __('Add New Member', 'cactusthemes'), 'add_new_item' => __('Add New Member', 'cactusthemes'), 'edit_item' => __('Edit Member', 'cactusthemes'), 'new_item' => __('New Member', 'cactusthemes'), 'view_item' => __('View Member', 'cactusthemes'), 'search_items' => __('Search Member', 'cactusthemes'), 'not_found' => __('No Member found', 'cactusthemes'), 'not_found_in_trash' => __('No Member found in Trash', 'cactusthemes'), 'parent_item_colon' => '');
$args = array('labels' => $labels, 'menu_position' => 8, 'supports' => array('title', 'editor', 'thumbnail'), 'public' => false, 'show_ui' => true, 'publicly_queryable' => true, 'has_archive' => true, 'hierarchical' => false, 'rewrite' => array('slug' => $member_slug));
register_post_type('member', $args);
}
示例7: tm_display_ads
function tm_display_ads($section)
{
$ad_top_1 = ot_get_option($section);
$adsense_publisher_id = ot_get_option('adsense_id');
$adsense_slot_top_1 = ot_get_option('adsense_slot_' . $section);
if ($adsense_publisher_id != '' && $adsense_slot_top_1 != '') {
?>
<div class='ad <?php
echo $section;
?>
'><?php
tm_echo_responsive_ad($adsense_publisher_id, $adsense_slot_top_1);
?>
</div>
<?php
} elseif ($ad_top_1 != '') {
?>
<div class='ad <?php
echo $section;
?>
'><?php
echo $ad_top_1;
?>
</div>
<?php
}
}
示例8: filter_css_value
/**
* This function filters all the CSS insertion values.
*/
function filter_css_value($value, $option_id)
{
// Custom Category Background
if ($option_id == 'category_background') {
$orn_cat_custom_bg = ot_get_option('orn_category_background');
if ($orn_cat_custom_bg) {
$category_bckg_settings = '';
foreach ($orn_cat_custom_bg as $orn_cat_bg) {
$cat_bg_sel = get_category($orn_cat_bg['orn_cat_bg_select']);
$cat_bg_name = isset($cat_bg_sel->name) ? $cat_bg_sel->name : false;
$cat_bg_slug = isset($cat_bg_sel->slug) ? $cat_bg_sel->slug : false;
$backgrounds = $orn_cat_bg['orn_cat_bg_image'];
$cat_bg_img = '';
$cat_bg_color = '';
$cat_bg_prop = '';
foreach ($backgrounds as $cat_background_key => $cat_background_value) {
switch ($cat_background_key) {
case 'background-image':
if (isset($cat_background_value)) {
$cat_bg_img = 'url("' . $cat_background_value . '")';
}
break;
case 'background-color':
if (isset($cat_background_value)) {
$cat_bg_color = $cat_background_value;
}
break;
default:
if ($cat_background_value) {
$cat_bg_prop .= ' ' . $cat_background_value;
}
break;
}
}
$category_bckg_settings .= '/* Custom Background for ' . $cat_bg_name . ' Category */' . "\n" . 'html > body.category-' . $cat_bg_slug . ' { ' . "\n" . ' background: ' . $cat_bg_color . ' ' . $cat_bg_img . $cat_bg_prop . ';' . "\n" . '}' . "\n" . '';
}
return $category_bckg_settings;
}
} elseif ($option_id == 'orn_font_title') {
// Google Fonts for title
$orn_title_font = ot_get_option('orn_font_title');
$select_font = $orn_title_font == 'default' ? 'PT+Sans:400,700' : $orn_title_font;
$title_font_name = '"' . str_replace("+", " ", strtok($select_font, ":")) . '";';
return $title_font_name;
} elseif ($option_id == 'orn_font_body') {
// Google Fonts for Body
$orn_body_font = ot_get_option('orn_font_body');
$select_font = $orn_body_font == 'default' ? 'Open+Sans:400,700' : $orn_body_font;
$body_font_name = '"' . str_replace("+", " ", strtok($select_font, ":")) . '";';
return $body_font_name;
} elseif ($option_id == 'orn_font_navigation') {
// Google Fonts for menu
$orn_nav_font = ot_get_option('orn_font_navigation');
$select_font = $orn_nav_font == 'default' ? 'Oswald:400,700' : $orn_nav_font;
$nav_font_name = '"' . str_replace("+", " ", strtok($select_font, ":")) . '";';
return $nav_font_name;
}
// Always return $value
return $value;
}
示例9: thb_twitter
function thb_twitter($atts, $content = null)
{
extract(shortcode_atts(array('username' => 'anteksiler', 'count' => '3', 'style' => 'dark'), $atts));
ob_start();
?>
<aside class="twitter_container <?php
echo $style;
?>
">
<i class="fa fa-twitter"></i>
<div class="carousel owl <?php
echo $style;
?>
" data-columns="1" data-navigation="false" data-pagination="true">
<?php
echo get_theme_tweets($username, ot_get_option('twitter_bar_consumerkey'), ot_get_option('twitter_bar_consumersecret'), ot_get_option('twitter_bar_accesstoken'), ot_get_option('twitter_bar_accesstokensecret'), $count);
?>
</div>
<a href="http://twitter.com/<?php
echo $username;
?>
">@<?php
echo $username;
?>
</a>
</aside>
<?php
$out = ob_get_contents();
if (ob_get_contents()) {
ob_end_clean();
}
return $out;
}
示例10: get
public function get($option_id, $default = '')
{
static $cached_options = array();
if (in_array($option_id, $this->keys()) && isset($_GET[$option_id])) {
return $_GET[$option_id];
}
if (isset($cached_options[$option_id]) && !is_customize_preview()) {
return $cached_options[$option_id];
}
$ot_keys = apply_filters('youxi_option_ot_keys', array());
$ot_on_off = apply_filters('youxi_option_ot_on_off', array());
if (in_array($option_id, $ot_keys)) {
if (in_array($option_id, $ot_on_off)) {
$return = 'on' === ot_get_option($option_id, $default);
} else {
$return = ot_get_option($option_id, $default);
}
} else {
$defaults = $this->defaults();
$options = $this->get_all();
if (isset($options[$option_id])) {
$return = $options[$option_id];
} elseif (isset($defaults[$option_id])) {
$return = $defaults[$option_id];
} else {
$return = $default;
}
}
return $cached_options[$option_id] = $return;
}
示例11: sp_frontend_scripts_styles
function sp_frontend_scripts_styles()
{
//Register CSS style
wp_enqueue_style('gfont-opensans', 'http://fonts.googleapis.com/css?family=Open+Sans:400,600,300,700', false, SP_THEME_VERSION);
wp_enqueue_style('theme-info', SP_BASE_URL . '/style.css', false, SP_THEME_VERSION);
wp_enqueue_style('fontello', SP_ASSETS . '/css/fontello.css', false, SP_THEME_VERSION);
wp_enqueue_style('normalize', SP_ASSETS . '/css/normalize.css', false, SP_THEME_VERSION);
wp_enqueue_style('base', SP_ASSETS . '/css/base.css', false, SP_THEME_VERSION);
wp_enqueue_style('animate', SP_ASSETS . '/css/animate.css', false, SP_THEME_VERSION);
wp_enqueue_style('flexslider', SP_ASSETS . '/css/flexslider.css', false, SP_THEME_VERSION);
wp_enqueue_style('flexslider-custom', SP_ASSETS . '/css/flexslider-custom.css', false, SP_THEME_VERSION);
wp_enqueue_style('magnific-popup', SP_ASSETS . '/css/magnific-popup.css', false, SP_THEME_VERSION);
wp_enqueue_style('magnific-custom', SP_ASSETS . '/css/magnific-custom.css', false, SP_THEME_VERSION);
wp_enqueue_style('main', SP_ASSETS . '/css/main.css', false, SP_THEME_VERSION);
//Register scripts
wp_enqueue_script('modernizr', SP_ASSETS . '/js/vendor/custom-modernizr.min.js', array('jquery'), SP_THEME_VERSION, false);
wp_enqueue_script('waypoint', SP_ASSETS . '/js/vendor/jquery.waypoints.min.js', array('jquery'), SP_THEME_VERSION, true);
wp_enqueue_script('easing', SP_ASSETS . '/js/vendor/jquery.easing.1.3.js', array('jquery'), SP_THEME_VERSION, true);
wp_enqueue_script('wow', SP_ASSETS . '/js/vendor/wow.min.js', array('jquery'), SP_THEME_VERSION, true);
wp_enqueue_script('flexslider', SP_ASSETS . '/js/vendor/jquery.flexslider.js', array('jquery'), SP_THEME_VERSION, true);
wp_enqueue_script('fitvideos', SP_ASSETS . '/js/vendor/jquery.fitvids.js', array('jquery'), SP_THEME_VERSION, true);
wp_enqueue_script('magnific-popup', SP_ASSETS . '/js/vendor/jquery.magnific-popup.min.js', array('jquery'), SP_THEME_VERSION, false);
wp_enqueue_script('main', SP_ASSETS . '/js/main.js', array('jquery'), SP_THEME_VERSION, true);
if (is_singular() && comments_open()) {
wp_enqueue_script('comment-reply');
}
if (ot_get_option('responsive') != 'off') {
wp_enqueue_style('responsive', SP_ASSETS . '/css/responsive.css', false, SP_THEME_VERSION);
}
wp_localize_script('main', 'theme_objects', array('base' => get_template_directory_uri(), 'commentProcess' => __('Processing your comment...', SP_TEXT_DOMAIN), 'commentError' => __('You might have left one of the fields blank, or be posting too quickly.', SP_TEXT_DOMAIN), 'commentSuccess' => __('Thanks for your response. Your comment will be published shortly after it\'ll be moderated.', SP_TEXT_DOMAIN)));
}
示例12: handleShortcode
public function handleShortcode($atts, $content = null)
{
extract(shortcode_atts(array('title' => '', 'active' => 'no', 'active_color' => ot_get_option('coll_accent_color'), 'bg_color' => '', 'class' => ''), $atts));
$active = $active == 'yes' ? ' active' : '';
$active_border = 'style="border-left-color:' . $active_color . '"';
//rnd
$rnd = rand(1, 9999);
// bg
if (!empty($bg_color)) {
$bg_color = 'style="background-color:' . $bg_color . '" ';
}
// build
$output = '';
$output .= '<div class="coll-accordion ' . $class . '" ' . $bg_color . '>';
$output .= '<dl class="accordion" data-accordion>';
$output .= '<dd class="' . $active . '" ' . $bg_color . ' >';
$output .= '<a href="#toggle-' . sanitize_title($title) . '-' . $rnd . '"
class="no-border" ' . $active_border . '
>' . $title . '</a>';
$output .= '<div id="toggle-' . sanitize_title($title) . '-' . $rnd . '" class="content ' . $active . '">';
$output .= do_shortcode($content);
$output .= '</div>';
$output .= '</dd>';
$output .= '</dl>';
$output .= '</div>';
return $output;
}
示例13: woo_buttons_class
function woo_buttons_class()
{
global $product;
$button_type = ot_get_option('button_type');
$output = sprintf('<a href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" data-quantity="%s" class="%s product_type_%s %s">%s</a>', esc_url($product->add_to_cart_url()), esc_attr($product->id), esc_attr($product->get_sku()), esc_attr(isset($quantity) ? $quantity : 1), $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button btn btn-primary btn-lg ' : '', esc_attr($product->product_type), esc_attr($button_type), esc_html($product->add_to_cart_text()));
return $output;
}
示例14: __construct
public function __construct()
{
// return if option tree is not defined
if (!function_exists('ot_get_option')) {
return;
}
$is_google_connect_enabled = ot_get_option('google_api_enabled', false);
if (!$is_google_connect_enabled) {
return;
}
$this->clientId = ot_get_option('google_api_client_id', '');
$this->clientSecret = ot_get_option('google_api_client_secret', '');
$this->redirectUri = admin_url('admin-ajax.php?action=clientConnectionInit');
if (empty($this->clientId)) {
return;
}
if (empty($this->clientSecret)) {
return;
}
$this->buttonLabel = ot_get_option('google_api_button_label', $this->buttonLabel);
add_action('klein_login_form', array($this, 'connectClient'), 1);
add_action('wp_ajax_clientConnectionInit', array($this, 'clientConnectionInit'));
add_action('wp_ajax_nopriv_clientConnectionInit', array($this, 'clientConnectionInit'));
add_action('login_head', array($this, 'errorLoggingIn'));
return;
}
示例15: landx_dynamic_style_load_to_footer
function landx_dynamic_style_load_to_footer()
{
if (function_exists('ot_get_option')) {
echo ot_get_option('footer_scripts');
}
//wp_enqueue_script( 'landx-retina', THEMEURI . 'js/retina-1.1.0.min.js', array( 'jquery' ), '3.1.5', true );
}