本文整理汇总了PHP中ya_options函数的典型用法代码示例。如果您正苦于以下问题:PHP ya_options函数的具体用法?PHP ya_options怎么用?PHP ya_options使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ya_options函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Ya_SelectMenu_Filter
function Ya_SelectMenu_Filter($args)
{
//var_dump($args);
$args['container'] = false;
$ya_theme_locate = ya_options()->getCpanelValue('menu_location');
$ya_menu_class = ya_options()->getCpanelValue('menu_visible');
if (strcmp($ya_theme_locate, $args['theme_location']) == 0) {
$args['menu_class'] = 'ya_selectmenu ' . $ya_menu_class;
$args['walker'] = new YA_Menu_Select();
$args['items_wrap'] = '<select class="%2$s">%3$s</select>';
}
return $args;
}
示例2: ya_google_analytics
function ya_google_analytics()
{
?>
<script>
var _gaq=[['_setAccount','<?php
echo ya_options()->getCpanelValue('google_analytics_id');
?>
'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
<?php
}
示例3: ya_nav_menu_args
/**
* Clean up wp_nav_menu_args
*
* Remove the container
* Use YA_Menu_Walker() by default
*/
function ya_nav_menu_args($args = '')
{
$ya_nav_menu_args['container'] = false;
if (!$args['items_wrap']) {
$ya_nav_menu_args['items_wrap'] = '<ul class="%2$s">%3$s</ul>';
}
if (!$args['walker']) {
if ('mega' == ya_options()->getCpanelValue('menu_type')) {
$ya_nav_menu_args['walker'] = new YA_Mega_Menu_Walker();
} else {
$ya_nav_menu_args['walker'] = new YA_Menu_Walker();
}
}
return array_merge($args, $ya_nav_menu_args);
}
示例4: ya_body_class
/**
* Add and remove body_class() classes
*/
function ya_body_class($classes)
{
$direction = ya_options()->getCpanelValue('direction');
if ($direction == 'rtl') {
$classes[] = 'rtl';
}
// Add post/page slug
if (is_single() || is_page() && !is_front_page()) {
$classes[] = basename(get_permalink());
}
// Remove unnecessary classes
$home_id_class = 'page-id-' . get_option('page_on_front');
$remove_classes = array('page-template-default', $home_id_class);
$classes = array_diff($classes, $remove_classes);
return $classes;
}
示例5: Ya_MenuRes_Filter
function Ya_MenuRes_Filter($args)
{
//var_dump($args);
$args['container'] = false;
$ya_theme_locate = ya_options()->getCpanelValue('menu_location');
$ya_menu_class = ya_options()->getCpanelValue('menu_visible');
if (strcmp($ya_theme_locate, $args['theme_location']) == 0) {
$args['container'] = 'div';
$args['container_class'] .= 'resmenu-container ' . $ya_menu_class;
$args['items_wrap'] = '<button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#ResMenu">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button><div id="ResMenu" class="collapse menu-responsive-wrapper"><ul id="%1$s" class="%2$s">%3$s</ul></div>';
$args['menu_class'] = 'ya_resmenu';
$args['walker'] = new YA_ResMenu_Walker();
}
return $args;
}
示例6: ya_parse_request
function ya_parse_request(&$wp)
{
global $add_query_vars, $options_args;
if (is_array($add_query_vars)) {
foreach ($add_query_vars as $field) {
if (array_key_exists($field, $wp->query_vars)) {
$current_value = ya_options()->get($field);
$request_value = $wp->query_vars[$field];
$field_name = $options_args['opt_name'] . '_' . $field;
if ($request_value != $current_value) {
setcookie($field_name, $request_value, time() + 86400, '/', COOKIE_DOMAIN, 0);
if (!isset($_COOKIE[$field_name]) || $request_value != $_COOKIE[$field_name]) {
$_COOKIE[$field_name] = $request_value;
}
//$url = curPageURL();
//header("Refresh: 0; url=$url");
//exit();
}
}
}
}
}
示例7: in_widget_form
public function in_widget_form($widget, $r = null, $instance = array())
{
//Logger::log(__CLASS__.'::'.__FUNCTION__);
//Logger::log( array_merge( array('instance' => get_class($widget)), $instance) );
$widget_advanced = ya_options()->getCpanelValue('widget-advanced');
if (!$widget_advanced) {
return;
}
$this->widget =& $widget;
//$widget_class_suffix = isset($instance['widget_class_suffix']) ? $instance['widget_class_suffix'] : '';
$widget_style = isset($instance['widget_style']) ? trim($instance['widget_style']) : '';
$adoptions = isset($instance['adoptions']) ? $instance['adoptions'] : false;
$adoptions_checked = $adoptions ? 'checked="checked"' : '';
$adoptions_on_class = $adoptions ? 'on' : '';
//Widgets Style
$styles = $this->getWidgetStyles();
$styles = array_merge(array('default' => 'Default'), $styles);
$styles = array_unique($styles);
//Widget Display
$widget_display = isset($instance['widget_display']) ? $instance['widget_display'] : array();
?>
<div class="advanced-opt <?php
echo $adoptions_on_class;
?>
">
<div class="advanced-opt-controls" >
<label class="button toggle" for="<?php
echo $widget->get_field_id('adoptions');
?>
">Advanced Options
<input type="checkbox" class="pane-toggler" <?php
echo $adoptions_checked;
?>
style="display: none;" name="<?php
echo $widget->get_field_name('adoptions');
?>
" id="<?php
echo $widget->get_field_id('adoptions');
?>
">
</label>
</div>
<div class="advanced-opt-pane">
<div class="advanced-opt-pane-inner">
<div class="pane-content">
<div class="pane-left">
<p>
<label for="<?php
echo $widget->get_field_id('widget_style');
?>
"><?php
_e('Widget Style', 'yatheme');
?>
</label> <select class="widefat"
id="<?php
echo $widget->get_field_id('widget_style');
?>
"
name="<?php
echo $widget->get_field_name('widget_style');
?>
">
<?php
foreach ($styles as $key => $value) {
$selected = '';
if ($key == $widget_style) {
$selected = 'selected="selected"';
}
?>
<option <?php
echo 'value="' . $key . '" ' . $selected;
?>
>
<?php
echo $value;
?>
</option>
<?php
}
?>
</select>
</p>
<?php
echo $this->render_wdisplay($widget_display);
?>
</div>
<div class="pane-right"></div>
</div>
</div>
</div>
<br class="clear">
</div>
<?php
}
示例8: ya_customize_register
/**
* Adds sections to the customizer
* @param WP_Customize_Control $wp_customize
*/
function ya_customize_register($wp_customize)
{
$priority = 200;
$sections = array();
$ya_options = ya_options();
$i = 0;
foreach ($ya_options->sections as $section) {
if (isset($section['fields']) && is_array($section['fields'])) {
foreach ($section['fields'] as $field) {
$customize = $field['id'] . '_customize_allow';
if ($ya_options->get($customize)) {
if (isset($field['options'])) {
$field['choices'] = $field['options'];
}
if ($field['type'] == 'upload') {
$field['type'] = 'image';
}
if ($field['type'] == 'radio_img') {
$field['type'] = 'select';
$field['choices'] = array();
foreach ($field['options'] as $key => $choices) {
$field['choices'][$key] = $choices['title'];
}
}
$field['label'] = $field['title'];
$field['section'] = sanitize_title($section['title']);
$field['settings'] = $ya_options->args['opt_name'] . '[' . $field['id'] . ']';
$field['priority'] = $priority++;
$sections[$i]['fields'][] = $field;
}
}
if (isset($sections[$i]['fields'])) {
$sections[$i]['title'] = $section['title'];
$sections[$i]['priority'] = $priority++;
$sections[$i]['capability'] = 'edit_theme_options';
$i++;
}
}
}
foreach ($sections as $section) {
// Add Section
$wp_customize->add_section(sanitize_title($section['title']), $section);
foreach ($section['fields'] as $field) {
//Add Setting
$wp_customize->add_setting($ya_options->args['opt_name'] . '[' . $field['id'] . ']', array('default' => $ya_options->get($field['id']), 'type' => 'option', 'transport' => 'postMessage', 'capability' => 'edit_theme_options', 'sanitize_callback' => 'customize_option'));
// Add Control
switch ($field['type']) {
case 'color':
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, $field['id'], $field));
break;
case 'image':
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, $field['id'], $field));
break;
case 'textarea':
$wp_customize->add_control(new WP_Customize_Textarea_Control($wp_customize, $field['id'], $field));
break;
default:
$wp_customize->add_control($field['id'], $field);
}
//$wp_customize->get_setting($ya_options->args['opt_name'].'['.$field['id'].']')->transport = 'postMessage';
}
}
$wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->get_setting('blogdescription')->transport = 'postMessage';
}
示例9: locate_template
require_once locate_template('/lib/plugins/currency-converter/currency-converter.php');
// currency converter
if (ya_options()->getCpanelValue('menu_type') == 'mega') {
function stop_removing_core_classes()
{
remove_filter('nav_menu_css_class', 'ya_nav_menu_css_class', 10, 2);
remove_filter('nav_menu_item_id', '__return_null');
}
add_action('init', 'stop_removing_core_classes');
require_once locate_template('/lib/ubermenu/ubermenu.php');
}
require_once locate_template('/lib/less.php');
// Custom functions
//active revolution slider
$revslider = get_template_directory() . '/lib/revslider/revslider.php';
if (!ya_options()->getCpanelValue('revslide_active')) {
include $revslider;
// Activate the plugin if necessary
if (get_option('ya_revslider_activated', '0') == '0') {
if (!class_exists('RevSliderAdmin')) {
$revslider_admin_script = get_template_directory() . '/lib/revslider/revslider_admin.php';
include $revslider_admin_script;
}
// Run activation script
$revslider_admin = new RevSliderAdmin($revslider);
$revslider_admin->onActivate();
// Save a flag that it is activated, so this won't run again
update_option('ya_revslider_activated', '1');
}
}
/* Disable WordPress Admin Bar for all users but admins. */
示例10: ya_options
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.4.0
*/
if (!defined('ABSPATH')) {
exit;
}
// Exit if accessed directly
global $product, $woocommerce_loop, $post;
if (empty($woocommerce_loop['loop'])) {
$woocommerce_loop['loop'] = 0;
}
$col_lg = ya_options()->getCpanelValue('product_col_large');
$col_md = ya_options()->getCpanelValue('product_col_medium');
$col_sm = ya_options()->getCpanelValue('product_col_sm');
$column1 = 12 / $col_md;
$column2 = 12 / $col_sm;
$class_col = "";
$col_large = 0;
// Store column count for displaying the grid
if (empty($woocommerce_loop['columns'])) {
$col_large = 12 / $col_lg;
} else {
$col_large = 12 / $woocommerce_loop['columns'];
}
// Ensure visibility
if (!$product || !$product->is_visible()) {
return;
}
// Increase loop count
示例11: ya_layout_class
function ya_layout_class($classes)
{
$header = ya_options()->getCpanelValue('box_layout');
if ($header == 'box') {
$classes[] = 'boxed';
}
// return the $classes array
return $classes;
}
示例12: ya_content_blog
}
?>
<div class="single main <?php
ya_content_blog();
?>
" >
<?php
get_template_part('templates/content', 'single');
?>
</div>
<?php
if (is_active_sidebar_YA('right-blog') && $sidebar_template != 'left_sidebar' && $sidebar_template != 'full') {
$right_span_class = 'col-lg-' . ya_options()->getCpanelValue('sidebar_right_expand');
$right_span_class .= ' col-md-' . ya_options()->getCpanelValue('sidebar_right_expand_md');
$right_span_class .= ' col-sm-' . ya_options()->getCpanelValue('sidebar_right_expand_sm');
?>
<aside id="right" class="sidebar <?php
echo esc_attr($right_span_class);
?>
">
<?php
dynamic_sidebar('right-blog');
?>
</aside>
<?php
}
?>
</div>
</div>
</div>
示例13: colorset
function colorset($atts)
{
$value = ya_options()->getCpanelValue('scheme');
return $value;
}
示例14: get_template_part
<?php
if (!have_posts()) {
get_template_part('templates/no-results');
}
$blog_columns = ya_options()->getCpanelValue('blog_column');
$col = 'col-sm-' . 12 / $blog_columns . ' theme-clearfix';
global $instance;
?>
<div class="row grid-blog">
<?php
while (have_posts()) {
the_post();
$format = get_post_format();
global $post;
?>
<div id="post-<?php
the_ID();
?>
" <?php
post_class($col);
?>
>
<div class="entry clearfix">
<?php
if ($format == '') {
?>
<?php
if (get_the_post_thumbnail()) {
?>
<div class="entry-thumb">
示例15: array
?>
</div>
</div>
<div class="container">
<?php
$portfolio = array();
$attributes = '';
$number = 8;
$orderby = 'date';
$order = '';
$portfolio_id = ya_options()->getCpanelValue('portfolio_id');
$style = ya_options()->getCpanelValue('p_style');
$col1 = ya_options()->getCpanelValue('p_col_large');
$col2 = ya_options()->getCpanelValue('p_col_medium');
$col3 = ya_options()->getCpanelValue('p_col_sm');
$col4 = ya_options()->getCpanelValue('p_col_xs');
$pf_id = 'ya_portfolio';
if (count($portfolio_id) > 0) {
$portfolio = $portfolio_id;
} else {
$terms = get_terms('portfolio_cat');
foreach ($terms as $k => $term) {
$portfolio[$k] = $term->term_id;
}
}
include plugin_dir_path(__FILE__) . 'portfolio-item.php';
?>
</div>
<?php
get_footer();