Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)" />
like image 492
2ne Avatar asked Apr 30 '26 13:04

2ne


1 Answers

See wp_enqueue_style() in the WordPress Codex, the last parameter in particular has to do with the CSS media.

wp_enqueue_style('html5blank', false, array(), false, 'all and (min-width: 1200px)');
like image 137
mushroom Avatar answered May 02 '26 06:05

mushroom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!