本文整理汇总了PHP中wp_is_mobile函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_is_mobile函数的具体用法?PHP wp_is_mobile怎么用?PHP wp_is_mobile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_is_mobile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wpex_footer_reveal_enabled
function wpex_footer_reveal_enabled($post_id = '')
{
// Disable on mobile
if (wp_is_mobile()) {
return false;
}
// Disable on 404
if (is_404()) {
return false;
}
// Disable on boxed style
if ('boxed' == wpex_main_layout()) {
return false;
}
// Get post id
$post_id = $post_id ? $post_id : wpex_get_the_ID();
// Meta check
if ($post_id) {
if ('on' == get_post_meta($post_id, 'wpex_footer_reveal', true)) {
return true;
} elseif ('off' == get_post_meta($post_id, 'wpex_footer_reveal', true)) {
return false;
}
}
// Theme option check
if (get_theme_mod('footer_reveal', false)) {
return true;
}
}
示例2: vantage_body_classes
/**
* Adds custom classes to the array of body classes.
*
* @since vantage 1.0
*/
function vantage_body_classes($classes)
{
// Adds a class of group-blog to blogs with more than 1 published author
if (is_multi_author()) {
$classes[] = 'group-blog';
}
if (siteorigin_setting('layout_responsive')) {
$classes[] = 'responsive';
}
$classes[] = 'layout-' . siteorigin_setting('layout_bound');
$classes[] = 'no-js';
$is_full_width_template = is_page_template('templates/template-full.php') || is_page_template('templates/template-full-notitle.php');
if (!$is_full_width_template) {
$wc_shop_sidebar = vantage_is_woocommerce_active() && is_shop() && is_active_sidebar('shop');
if (!is_active_sidebar('sidebar-1') && !$wc_shop_sidebar) {
$classes[] = 'no-sidebar';
} else {
$classes[] = 'has-sidebar';
}
}
if (wp_is_mobile()) {
$classes[] = 'so-vantage-mobile-device';
}
$mega_menu_active = function_exists('max_mega_menu_is_enabled') && max_mega_menu_is_enabled('primary');
if (siteorigin_setting('navigation_menu_search') && !$mega_menu_active) {
$classes[] = 'has-menu-search';
}
if (siteorigin_setting('layout_force_panels_full')) {
$classes[] = 'panels-style-force-full';
}
return $classes;
}
示例3: siteorigin_north_body_classes
/**
* Adds custom classes to the array of body classes.
*
* @param array $classes Classes for the body element.
* @return array
*/
function siteorigin_north_body_classes($classes)
{
// Adds a class of group-blog to blogs with more than 1 published author.
if (is_multi_author()) {
$classes[] = 'group-blog';
}
$classes[] = 'no-js';
$classes[] = 'css3-animations';
$classes[] = 'responsive';
if (is_page()) {
$classes[] = 'page-layout-' . SiteOrigin_Settings_Page_Settings::get('layout');
$classes[] = 'page-layout-menu-' . SiteOrigin_Settings_Page_Settings::get('menu');
if (!SiteOrigin_Settings_Page_Settings::get('masthead_margin')) {
$classes[] = 'page-layout-no-masthead-margin';
}
if (!SiteOrigin_Settings_Page_Settings::get('footer_margin')) {
$classes[] = 'page-layout-no-footer-margin';
}
}
if (!is_active_sidebar('main-sidebar')) {
$classes[] = 'no-active-sidebar';
}
if (siteorigin_setting('navigation_sticky')) {
$classes[] = 'sticky-menu';
}
if (wp_is_mobile()) {
$classes[] = 'is_mobile';
}
return $classes;
}
示例4: zAlive_add_mobile_device_class
function zAlive_add_mobile_device_class($classes)
{
if (wp_is_mobile()) {
$classes[] = 'is-mobile';
}
return $classes;
}
示例5: defaallowmobile
function defaallowmobile()
{
if (wp_is_mobile()) {
remove_action('wp_head', 'defago');
remove_action('wp_footer', 'defaset');
}
}
示例6: Setup
static function Setup($custom = false)
{
global $user_ID;
$screen = get_current_screen();
//$screen->get_option('layout_colums', 2);
//add_filter('screen_layout_columns', array(__CLASS__, 'screenLayoutColumns'), 10, 2);
if ($custom && !wp_is_mobile()) {
add_screen_option('layout_columns', array('max' => 2, 'default' => 2));
}
if (WPFB_Core::CurUserCanUpload()) {
add_meta_box('wpfb-add-file-widget', ($custom ? '' : WPFB_PLUGIN_NAME . ': ') . __('Add File', 'wp-filebase'), array(__CLASS__, 'WidgetAddFile'), $screen, 'normal', 'default', array(!$custom));
}
if ($custom) {
if (!empty($_GET['wpfb-hide-how-start'])) {
update_user_option($user_ID, WPFB_OPT_NAME . '_hide_how_start', 1);
}
$show_how_start = !(bool) get_user_option(WPFB_OPT_NAME . '_hide_how_start');
add_meta_box('wpfb-tools', __('Tools'), array(__CLASS__, 'WidgetTools'), $screen, 'side', 'default');
add_meta_box('wpfb-stats', __('Statistics', 'wp-filebase'), array(__CLASS__, 'WidgetStats'), $screen, 'side', 'default');
add_meta_box('wpfb-getstarted', sprintf(__('How to get started with %s?', 'wp-filebase'), WPFB_PLUGIN_NAME), array(__CLASS__, 'WidgetGetStarted'), $screen, 'side', $show_how_start ? 'high' : 'low');
add_meta_box('wpfb-about', __('About', 'wp-filebase'), array(__CLASS__, 'WidgetAbout'), $screen, 'side', 'default');
add_meta_box('wpfb-logs', __('Log Files', 'wp-filebase'), array(__CLASS__, 'WidgetLogFiles'), $screen, 'side', 'low');
//add_meta_box('wpfb-', __('','wp-filebase'), array(__CLASS__, ''), $screen, 'normal', 'default' );
//$screen->render_screen_meta();
}
}
示例7: yith_wcmg_is_enabled
/**
* Check if the plugin is enabled for the current context
*
* @return bool
* @since 1.0.0
*/
function yith_wcmg_is_enabled()
{
if (wp_is_mobile()) {
return 'yes' == get_option('yith_wcmg_enable_mobile');
}
return get_option('yith_wcmg_enable_plugin') == 'yes';
}
示例8: widget
/**
* Outputs the HTML for this widget.
*
* @param array An array of standard parameters for widgets in this theme
* @param array An array of settings for this widget instance
* @return void Echoes it's output
**/
function widget($args, $instance)
{
$instance = wp_parse_args($instance, $this->defaults());
extract($args, EXTR_SKIP);
echo $before_widget;
if ($instance['title'] != '') {
echo $before_title . $instance['title'] . $after_title;
}
$map_link = 0;
if ($instance['address'] != '') {
$showmap = $instance['showmap'];
if ($showmap && $this->has_good_map($instance)) {
$lat = $instance['lat'];
$lon = $instance['lon'];
echo $this->build_map($lat, $lon);
}
$map_link = $this->build_map_link($instance['address']);
echo '<div class="confit-address"><a href="' . esc_url($map_link) . '" target="_blank">' . str_replace("\n", "<br/>", esc_html($instance['address'])) . "</a></div>";
}
if ($instance['phone'] != '') {
if (wp_is_mobile()) {
echo '<div class="confit-phone"><a href="' . esc_url('tel:' . $instance['phone']) . '">' . esc_html($instance['phone']) . "</a></div>";
} else {
echo '<div class="confit-phone">' . esc_html($instance['phone']) . '</div>';
}
}
if ($instance['hours'] != '') {
echo '<div class="confit-hours">' . str_replace("\n", "<br/>", esc_html($instance['hours'])) . "</div>";
}
echo $after_widget;
}
示例9: fruitful_description_box
function fruitful_description_box($atts, $content = null)
{
$out = '';
shortcode_atts(array('id' => '', 'style' => ''), $atts, 'fruitful_dbox');
$id = 'desc-box-' . rand(1, 100);
if (wp_is_mobile()) {
$style = ' font-size: 20px; text-transform : uppercase; text-align: center; font-weight: 300; line-height: 1.2;';
} else {
$style = ' font-size: 40px; text-transform : uppercase; text-align: center; font-weight: 300; line-height: 1.2;';
}
if (!empty($atts['id'])) {
$id = sanitize_html_class($atts['id']);
}
if (!empty($atts['style'])) {
$style = esc_html($atts['style']);
}
$out .= '<div class="fruitful_description_box">';
$out .= '<div class="fruitful_description" id="' . $id . '">';
if (!empty($content)) {
$out .= '<div class="text" style="' . $style . '">' . $content . '</div>';
} else {
$out .= '<div class="text" style="' . $style . '">No text Description</div>';
}
$out .= '</div>';
$out .= '</div>';
$out .= '<div class="clearfix"></div>';
return $out;
}
示例10: head
public static function head()
{
wp_enqueue_script('formidable-editinplace');
if (wp_is_mobile()) {
wp_enqueue_script('jquery-touch-punch');
}
}
示例11: print_options
public static function print_options()
{
$config = get_option(Village::$key . "_js_options");
$js_vars = array('config' => $config, 'wp' => array('isMobile' => wp_is_mobile()));
$js_options = apply_filters('themevillage_javascript_variables', $js_vars);
wp_localize_script('village-app', '__VILLAGE_VARS', $js_options);
}
示例12: __construct
/**
* Initialize the class and set its properties.
*
* @since 1.0.0
* @var string $name The name of the plugin.
* @var string $version The version of this plugin.
*/
public function __construct($name, $version)
{
$this->name = $name;
$this->version = $version;
$this->settings = PeHaa_Themes_Page_Builder::$settings;
self::$is_mobile = apply_filters($this->name . '_is_mobile', wp_is_mobile());
}
示例13: calibrefx_init_mobile_site
/**
* If mobile site is enable and there is a mobile template, then display mobile layout on mobile
*/
function calibrefx_init_mobile_site()
{
global $calibrefx;
//Register mobile menu
register_nav_menus(array('mobile' => apply_filters('mobile_menu_text', __('Mobile Navigation Menu', 'calibrefx'))));
if (is_admin() or !wp_is_mobile()) {
return;
}
remove_theme_support('calibrefx-footer-widgets');
remove_theme_support('calibrefx-header-right-widgets');
//Disable wp admin bar
show_admin_bar(false);
add_filter('body_class', 'calibrefx_mobile_site_body_class');
add_filter('wrapper_class', 'calibrefx_mobile_wrapper_class');
add_filter('wrapper_attr', 'calibrefx_mobile_wrapper_attr');
remove_action('calibrefx_after_header', 'calibrefx_do_nav');
remove_action('calibrefx_after_header', 'calibrefx_do_subnav', 15);
add_action('calibrefx_before_wrapper', 'calibrefx_do_top_mobile_nav');
add_action('calibrefx_after_wrapper', 'calibrefx_do_mobile_footer', 100);
add_filter('template_include', 'calibrefx_get_mobile_template');
if (file_exists(CHILD_MOBILE_URI . '/functions.php')) {
load_template(CHILD_MOBILE_URI . '/functions.php');
}
$calibrefx->hooks->remove('calibrefx_before_loop', 'calibrefx_do_breadcrumbs', 10);
$calibrefx->hooks->remove('calibrefx_before_loop', 'calibrefx_do_notification', 20);
$calibrefx->hooks->remove('calibrefx_sidebar', 'calibrefx_do_sidebar');
$calibrefx->hooks->remove('calibrefx_sidebar_alt', 'calibrefx_do_sidebar_alt');
$calibrefx->hooks->remove('calibrefx_after_post_content', 'calibrefx_do_author_box_single', 20);
$calibrefx->hooks->remove('calibrefx_footer', 'calibrefx_footer_area', 10);
//On mobile there is no sidebar
add_filter('calibrefx_site_layout', 'calibrefx_layout_full_width');
}
示例14: ality_scripts
function ality_scripts()
{
wp_enqueue_style('style', get_stylesheet_uri(), array(), '2014.8.1');
wp_enqueue_style('mediaqueries', get_template_directory_uri() . '/css/mediaqueries.css', array(), '1.0');
wp_enqueue_style('s', get_template_directory_uri() . '/s', array(), '0');
// 临时
if (is_singular()) {
wp_enqueue_style('highlight', get_template_directory_uri() . '/css/highlight.css', array(), '1.0');
}
wp_enqueue_script('jquery.min', get_template_directory_uri() . '/js/jquery.min.js', array(), '1.4.2', false);
wp_enqueue_script('script', get_template_directory_uri() . '/js/script.js', array(), '1.0', false);
wp_enqueue_script('jquery.sidr.min', get_template_directory_uri() . '/js/jquery.sidr.min.js', array(), '1.2.1', false);
wp_enqueue_script('jquery.lazyload.min', get_template_directory_uri() . '/js/jquery.lazyload.min.js', array(), '1.9.3', false);
if (wp_is_mobile()) {
} else {
wp_enqueue_script('pc', get_template_directory_uri() . '/js/script-pc.js', array(), '1.0', false);
}
if (is_singular()) {
wp_enqueue_script('fancybox', get_template_directory_uri() . '/js/fancybox.js', array(), '1.3.4', false);
wp_enqueue_script('mousewheel', get_template_directory_uri() . '/js/mousewheel.js', array(), '3.0.4', false);
wp_enqueue_script('comments-ajax', get_template_directory_uri() . '/js/comments-ajax.js', array(), '1.3', false);
}
// 加载回复js
// if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
// wp_enqueue_script( 'comment-reply' );
// }
}
示例15: register_scripts
/**
* Register javascripts on front pages.
*
* @since 1.0.0
*/
public static function register_scripts()
{
global $is_IE;
if (!(wp_is_mobile() || $is_IE && preg_match('/MSIE [56789]/', $_SERVER['HTTP_USER_AGENT']))) {
// Lazy Load Effect.
wp_register_script('cherry-lazy-load-effect', plugins_url('assets/js/shotcodes/lazy-load-effect.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
}
// Magnific Popup.
wp_register_script('magnific-popup', plugins_url('assets/js/jquery.magnific-popup.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
// Google Maps.
wp_register_script('googlemapapis', '//maps.googleapis.com/maps/api/js?v=3.exp&signed_in=false', array(), false, true);
wp_register_script('cherry-google-map', plugins_url('assets/js/shotcodes/google-map.min.js', CHERRY_SHORTCODES_FILE), array('jquery', 'googlemapapis'), CHERRY_SHORTCODES_VERSION, true);
// Swiper.
wp_register_script('swiper', plugins_url('assets/js/shotcodes/swiper.jquery.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
// Parallax.
wp_register_script('device', plugins_url('assets/js/shotcodes/device.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
wp_register_script('cherry-parallax', plugins_url('assets/js/shotcodes/parallax.min.js', CHERRY_SHORTCODES_FILE), array('jquery', 'device'), CHERRY_SHORTCODES_VERSION, true);
// Counter.
wp_register_script('waypoints', plugins_url('assets/js/shotcodes/waypoints.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
wp_register_script('jquery-counterup', plugins_url('assets/js/shotcodes/jquery.counterup.min.js', CHERRY_SHORTCODES_FILE), array('waypoints'), CHERRY_SHORTCODES_VERSION, true);
// Video Preview.
wp_register_script('video-preview', plugins_url('assets/js/shotcodes/video-preview.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
wp_register_script('video-youtube', 'https://www.youtube.com/player_api/', array('jquery', 'video-preview'), null, true);
// Countdown
wp_register_script('jquery-countdown', plugins_url('assets/js/shotcodes/jquery.countdown.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
// Page Anchor.
wp_register_script('page-anchor', plugins_url('assets/js/shotcodes/page-anchor.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
// Shortcodes init.
wp_register_script('cherry-shortcodes-init', plugins_url('assets/js/shotcodes/init.min.js', CHERRY_SHORTCODES_FILE), array('jquery'), CHERRY_SHORTCODES_VERSION, true);
// Hook to deregister javascripts or add custom.
do_action('cherry_shortcodes/assets/register_scripts');
}