简体   繁体   中英

Wordpress wp_enqueue stylesheet with media query

I use a media query in my html to load a new stylesheet for the grid if needed. Can I translate this to work within my functions.php?

wp_register_style('html5blank', get_template_directory_uri() . '/style.css', array(), '1.0', 'all');
wp_enqueue_style('html5blank'); // Enqueue it!


<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/1140.css" type="text/css" media="all and (min-width: 1200px)" />

请参阅WordPress Codex中的wp_enqueue_style() ,特别是最后一个参数与CSS媒体有关。

wp_enqueue_style('html5blank', false, array(), false, 'all and (min-width: 1200px)');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM