带有媒体查询的Wordpress wp_enqueue样式表

2ne*_*2ne 2 php wordpress query-optimization css3

我在我的html中使用媒体查询,以便在需要时为网格加载新的样式表.我可以将其翻译为在我的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)" />
Run Code Online (Sandbox Code Playgroud)

mus*_*oom 7

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

wp_enqueue_style('html5blank', false, array(), false, 'all and (min-width: 1200px)');
Run Code Online (Sandbox Code Playgroud)