本文整理汇总了PHP中Mobile_Detect::is_mobile_or_tablet方法的典型用法代码示例。如果您正苦于以下问题:PHP Mobile_Detect::is_mobile_or_tablet方法的具体用法?PHP Mobile_Detect::is_mobile_or_tablet怎么用?PHP Mobile_Detect::is_mobile_or_tablet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mobile_Detect
的用法示例。
在下文中一共展示了Mobile_Detect::is_mobile_or_tablet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: language_attributes
<!DOCTYPE html>
<html <?php
language_attributes();
?>
class="no-js <?php
echo Mobile_Detect::is_mobile_or_tablet() ? 'small-device' : 'large-device';
?>
">
<head>
<meta charset="<?php
bloginfo('charset');
?>
">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="<?php
bloginfo('description');
?>
">
<meta name="author" content="<?php
the_author();
?>
">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php
bloginfo('pingback_url');
?>
">
示例2: willow_action_enqueue_scripts
/**
* Enqueue styles and scripts
*/
function willow_action_enqueue_scripts()
{
$theme_data = wp_get_theme();
/**
* CSS
*/
// GoogleFonts
$font_weights = array(100, 200, 300, 400, 500, 600, 700, 800, 900);
$font_styles = array('normal', 'italic');
global $willow_data;
foreach ($willow_data['typography_types'] as $type => $label) {
if (!in_array(willow_option($type . '_font_face'), willow_get_regular_font_faces())) {
VP_Site_GoogleWebFont::instance()->add(willow_option($type . '_font_face'), $font_weights, $font_styles);
}
}
VP_Site_GoogleWebFont::instance()->register();
foreach (VP_Site_GoogleWebFont::instance()->get_names() as $name) {
wp_enqueue_style($name);
}
// Other CSS
wp_register_style('willow-bootstrap', WILLOW_CSS . 'bootstrap.willow.min.css', array(), '3.1.1');
wp_register_style('fontawesome', WILLOW_CSS . 'font-awesome.min.css', array(), '4.0.3');
wp_register_style('linecons', WILLOW_CSS . 'linecons.css', array(), '1.0.0');
wp_register_style('animate', WILLOW_CSS . 'animate.css', array(), '3.1.0-dev');
wp_register_style('mediaelement', WILLOW_CSS . 'mediaelementplayer.min.css', array(), '2.14.2');
wp_register_style('willow-jquery-magnific-popup', WILLOW_CSS . 'magnific-popup.willow.css', array(), '0.9.9');
wp_register_style('willow-style', WILLOW_CSS . 'style.css', array('willow-bootstrap', 'fontawesome', 'linecons', 'animate', 'mediaelement', 'willow-jquery-magnific-popup'), $theme_data->get('Version'));
wp_enqueue_style('willow-style');
// Dynamic sStyle
ob_start();
include WILLOW_CSS_DIR . '/style-dynamic.php';
$dynamic_style = ob_get_clean();
wp_add_inline_style('willow-style', $dynamic_style);
wp_add_inline_style('willow-style', willow_option('custom_css'));
// Theme stylesheet
wp_enqueue_style('style', get_stylesheet_uri());
// WP default stylesheet
/**
* JS
*/
// Less than IE9 polyfills
global $wp_scripts;
wp_register_script('html5shiv', WILLOW_JS . 'html5shiv.js', array(), '3.7.0');
$wp_scripts->add_data('html5shiv', 'conditional', 'lt IE 9');
wp_enqueue_script('html5shiv');
wp_register_script('respond', WILLOW_JS . 'respond.min.js', array(), '1.4.2');
$wp_scripts->add_data('respond', 'conditional', 'lt IE 9');
wp_enqueue_script('respond');
wp_register_script('bootstrap', WILLOW_JS . 'bootstrap.min.js', array('jquery'), '3.1.1');
wp_register_script('smoothscroll', WILLOW_JS . 'smoothscroll.min.js', array('jquery'), '1.2.1');
wp_register_script('jquery-sharrre', WILLOW_JS . 'jquery.sharrre.min.js', array('jquery'), '1.3.5');
wp_register_script('jquery-touchswipe', WILLOW_JS . 'jquery.touchswipe.min.js', array('jquery'), '1.3.3');
wp_register_script('jquery-caroufredsel', WILLOW_JS . 'jquery.caroufredsel-packed.js', array('jquery', 'imagesloaded', 'jquery-touchswipe'), '6.2.1');
wp_register_script('jquery-waypoints', WILLOW_JS . 'waypoints.min.js', array(), '2.0.4');
wp_register_script('jquery-magnific-popup', WILLOW_JS . 'jquery.magnific-popup.min.js', array('jquery'), '0.9.9');
wp_register_script('jquery-parallax', WILLOW_JS . 'jquery.parallax.min.js', array('jquery'), '1.1.3');
wp_register_script('jquery-jpreloader', WILLOW_JS . 'jpreloader.min.js', array('jquery'), '2.1');
wp_register_script('jquery-hoverintent', WILLOW_JS . 'hoverintent.js', array('jquery'), '1.7.4');
wp_register_script('jquery-superfish', WILLOW_JS . 'superfish.js', array('jquery', 'jquery-hoverintent'), '1.7.4');
wp_register_script('jquery-fittext', WILLOW_JS . 'jquery.fittext.js', array('jquery'), '1.2');
wp_register_script('gmap-api', 'http://maps.google.com/maps/api/js?sensor=false');
wp_register_script('jquery-gmap3', WILLOW_JS . 'gmap3.min.js', array('jquery', 'gmap-api'), '6.0.0');
wp_register_script('imagesloaded', WILLOW_JS . 'imagesloaded.pkgd.min.js', array(), '3.1.4');
if (!wp_script_is('isotope', 'registered')) {
wp_deregister_script('isotope');
wp_register_script('isotope', WILLOW_JS . 'isotope.pkgd.min.js', array('imagesloaded'), '2.0.0');
} else {
willow_append_dependency('isotope', 'imagesloaded');
}
wp_register_script('mediaelement', WILLOW_JS . 'mediaelement-and-player.min.js', array('jquery'), '2.14.2');
wp_register_script('countup', WILLOW_JS . 'countup.min.js', array(), '1.1.0');
wp_register_script('willow-modernizr', WILLOW_JS . 'modernizr.willow.min.js', array(), '2.8.1');
wp_register_script('willow-script', WILLOW_JS . 'script.js', array('jquery', 'jquery-waypoints', 'jquery-superfish', 'bootstrap', 'smoothscroll', 'mediaelement', 'jquery-fittext'), $theme_data->get('Version'));
wp_enqueue_script('willow-script');
if (willow_option('enable_preloader', 1)) {
wp_enqueue_script('jquery-jpreloader');
}
$willow_data['localize']['gmap_style_json'] = trim(willow_option('gmap_style_json', ''));
$willow_data['localize']['is_mobile_or_tablet'] = Mobile_Detect::is_mobile_or_tablet() ? 'true' : 'false';
wp_localize_script('willow-script', 'willow', $willow_data['localize']);
}
示例3: ld_theme_scripts
/**
* Embed Scripts into Page
*/
function ld_theme_scripts()
{
$theme_data = wp_get_theme();
/**
* CSS
*/
// Theme stylesheet
wp_enqueue_style('style', get_stylesheet_uri());
// WP default stylesheet
// GoogleFonts
global $lovey_dovey_data;
$font_weights = array(100, 200, 300, 400, 500, 600, 700, 800, 900);
$font_styles = array('normal', 'italic');
foreach ($lovey_dovey_data['typography_types'] as $type => $label) {
if (!in_array(ld_option($type . '_font_face'), ld_get_regular_font_faces())) {
VP_Site_GoogleWebFont::instance()->add(ld_option($type . '_font_face'), $font_weights, $font_styles);
}
}
VP_Site_GoogleWebFont::instance()->register_and_enqueue();
// Other CSS
// wp_register_style( 'bootstrap', LD_CSS . 'bootstrap.min.css', array(), '3.1.1' );
wp_register_style('bootstrap-ld', LD_CSS . 'bootstrap.ld.css', array(), '3.1.1');
wp_register_style('fontawesome', LD_CSS . 'font-awesome.min.css', array(), '4.0.3');
wp_register_style('linecons', LD_CSS . 'linecons.css', array(), '1.0.0');
wp_register_style('socmed', LD_CSS . 'socmed.css', array());
wp_register_style('countdown', LD_CSS . 'jquery.countdown.css', array());
wp_register_style('jquery-magnific-popup', LD_CSS . 'magnific-popup.css', array(), '0.9.9');
wp_register_style('jquery-justifiedgallery', LD_CSS . 'justifiedgallery.min.css', array(), '3.2.0');
wp_register_style('ld-style', LD_CSS . 'style.css', array('bootstrap-ld', 'fontawesome', 'linecons', 'socmed', 'countdown', 'jquery-magnific-popup', 'jquery-justifiedgallery'), $theme_data->get('Version'));
wp_enqueue_style('ld-style');
// Dynamic Style
ob_start();
include LD_CSS_DIR . '/style-dynamic.php';
$dynamic_style = ob_get_clean();
wp_add_inline_style('ld-style', $dynamic_style);
wp_add_inline_style('ld-style', ld_option('custom_css'));
/**
* JS
*/
wp_enqueue_script('modernizr', LD_JS . 'modernizr-latest.js');
wp_register_script('bootstrap', LD_JS . 'bootstrap.min.js', array('jquery'), '3.1.1');
wp_register_script('smoothscroll', LD_JS . 'smoothscroll.min.js', array('jquery'), '1.2.1');
wp_register_script('jquery-backstretch', LD_JS . 'jquery.backstretch.min.js', array('jquery'), '2.0.4');
wp_register_script('jquery-plugin', LD_JS . 'jquery.plugin.min.js', array('jquery'));
wp_register_script('jquery-countdown', LD_JS . 'jquery.countdown.min.js', array('jquery', 'jquery-plugin'));
wp_register_script('jquery-parallax', LD_JS . 'jquery.parallax.min.js', array('jquery'), '1.1.3');
wp_register_script('jquery-countdown-br', LD_JS . 'jquery.countdown.pt-BR.js', array('jquery'), '2.0.0');
wp_register_script('jquery-magnific-popup', LD_JS . 'jquery.magnific-popup.min.js', array('jquery'), '0.9.9');
wp_register_script('jquery-justifiedgallery', LD_JS . 'jquery.justifiedgallery.min.js', array('jquery', 'jquery-magnific-popup'), '3.2.0');
wp_register_script('jquery-waypoints', LD_JS . 'waypoints.min.js', array(), '2.0.4');
wp_register_script('imagesloaded', LD_JS . 'imagesloaded.pkgd.min.js', array(), '3.1.4');
wp_register_script('gmap-api', 'http://maps.google.com/maps/api/js?sensor=false');
wp_register_script('jquery-gmap3', LD_JS . 'gmap3.min.js', array('jquery', 'gmap-api'), '6.0.0');
wp_deregister_script('isotope');
wp_register_script('isotope', LD_JS . 'isotope.pkgd.min.js', array('imagesloaded'), '2.0.0');
wp_register_script('ld-script', LD_JS . 'script.js', array('jquery', 'bootstrap', 'smoothscroll', 'jquery-backstretch', 'jquery-countdown', 'jquery-magnific-popup', 'jquery-justifiedgallery', 'jquery-waypoints', 'jquery-gmap3', 'isotope', 'jquery-countdown-br'), $theme_data->get('Version'));
wp_enqueue_script('ld-script');
wp_localize_script('ld-script', 'loveydovey', array('gb_name_id' => ld_option('gb_name_id'), 'gb_message_id' => ld_option('gb_message_id'), 'is_mobile_or_tablet' => Mobile_Detect::is_mobile_or_tablet() ? 'true' : 'false'));
}
示例4: elseif
} elseif ($media == 'video') {
?>
<?php
$video_source = willow_hero_slide_option('video_source', null, $slide_id);
$video_source_webm = willow_hero_slide_option('video_source_webm', null, $slide_id);
$video_source_ogg = willow_hero_slide_option('video_source_ogg', null, $slide_id);
$video_poster = willow_hero_slide_option('video_poster', null, $slide_id);
$video_ratio = willow_hero_slide_option('video_ratio', '16:9', $slide_id);
$video_mute = willow_hero_slide_option('video_mute', false, $slide_id);
$video_id = willow_generate_id('video-background-');
$has_video = true;
?>
<?php
if (Mobile_Detect::is_mobile_or_tablet()) {
?>
<li class="<?php
echo $enable_parallax ? 'parallax-background js-parallax' : '';
?>
<?php
echo "{$color_scheme}-scheme hero-slide-{$text_style}";
?>
" style="background-image: url(<?php
echo $video_poster;
?>
); background-size: cover; background-repeat: no-repeat; background-position: center center;" data-parallax="background">
<?php
echo $slide_content;
?>
</li>