Created
September 4, 2013 20:27
-
-
Save pmgllc/6442406 to your computer and use it in GitHub Desktop.
"Mobile first" methodology. Place the CSS query in function.php to call a mobile stylesheet to save bandwidth. That is the no-mq.css file. If viewed on a device larger than 480px, then it also calls a CSS file that includes a more traditional responsive stylesheet with media queries at the end, but geared for desktops at the top. I've also inclu…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Add in new media query stylesheets for functions.php */ | |
// Add custom.css file in <head> | |
add_action('genesis_meta', 'pmg_add_customcss'); | |
function pmg_add_customcss( ) { | |
$pmg_css_link = ' | |
<link href="'.get_bloginfo( 'stylesheet_directory' ).'/no-mq.css" rel="stylesheet"> | |
<!--[if (gte IE 9) | (IEMobile)]><!--> | |
<link href="'.get_bloginfo( 'stylesheet_directory' ).'/mq.css" rel="stylesheet" type="text/css" media="only screen and (min-device-width: 480px)"> | |
<!--<![endif]-->'; | |
echo $pmg_css_link; | |
} | |
/** Call smaller grid loop images (many implications) | |
/** | |
* Grid Loop Arguments | |
* | |
* Specify all the desired grid loop and query arguments | |
* | |
* @author Bill Erickson | |
* @author Gary Jones | |
* @link http://code.garyjones.co.uk/genesis-grid-loop-advanced/ | |
* | |
* @return array $arguments | |
*/ | |
function child_grid_loop_arguments() { | |
if ( wp_is_mobile() ) { | |
$grid_args = array( | |
'features' => 0, | |
'feature_content_limit' => 0, | |
'feature_image_size' => 0, | |
'feature_image_class' => '', | |
'grid_content_limit' => 100, | |
'grid_image_size' => 'mobile', | |
'grid_image_class' => 'alignnone post-image', | |
'more' => __( '+ read more', 'genesis' ), | |
); | |
$query_args = array( | |
'posts_per_page' => 6, | |
); | |
return array( | |
'grid_args' => $grid_args, | |
'query_args' => $query_args, | |
); | |
} | |
else { | |
$grid_args = array( | |
'features' => 0, | |
'feature_content_limit' => 0, | |
'feature_image_size' => 0, | |
'feature_image_class' => '', | |
'grid_content_limit' => 120, | |
'grid_image_size' => 'post-image', | |
'grid_image_class' => 'alignnone post-image', | |
'more' => __( '+ read more', 'genesis' ), | |
); | |
$query_args = array( | |
'posts_per_page' => 6, | |
); | |
return array( | |
'grid_args' => $grid_args, | |
'query_args' => $query_args, | |
); | |
} | |
} |
GaryJones
commented
Sep 4, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment