grid-columns icon indicating copy to clipboard operation
grid-columns copied to clipboard

Add filter for CSS media type

Open mvirenius opened this issue 10 years ago • 4 comments

Could you add filter for CSS media type? It could make easier to exclude default column CSS in specific screen sizes, for example when you are designing responsive theme. Nobody wants to read 100px width columns in their mobile screens.

Example usage of the filter: add_filter('gc_css_media_type', function(){ return '(min-width:480px)'; });

mvirenius avatar Sep 11 '14 10:09 mvirenius

Adding an extra hook here seems like unnecessary overhead that can be avoided. WordPress already provides the functionality needed out of the box.

You can do it with functions:

  • http://codex.wordpress.org/Function_Reference/wp_dequeue_style
  • http://codex.wordpress.org/Function_Reference/wp_enqueue_style

There are also several hooks available:

  • style_loader_tag (best option)
  • print_styles_array
  • style_loader_src

justintadlock avatar Sep 11 '14 13:09 justintadlock

why not a simple media query in css file?

@media only screen and (max-width: 480px) {
      .column-grid .column{
        width:100%!important;
        margin-left:0!important;
        margin-right:0!important;
    }
}

bluantinoo avatar Feb 11 '16 11:02 bluantinoo

bit hacky dont ya think ?

Firestorm-Graphics avatar Feb 11 '16 11:02 Firestorm-Graphics

For mobiles I don't think. usually any column system or builder makes column 100% width on mobiles. Do you imagine a better solution?

bluantinoo avatar Feb 12 '16 09:02 bluantinoo