Skip to content

Instantly share code, notes, and snippets.

@Viper007Bond
Created April 7, 2014 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Viper007Bond/10040166 to your computer and use it in GitHub Desktop.
Save Viper007Bond/10040166 to your computer and use it in GitHub Desktop.
Default WordPress to use 4 column galleries
<?php
add_filter( 'shortcode_atts_gallery', 'sheri_galleries_default_to_four_columns', 10, 3 );
function sheri_galleries_default_to_four_columns( $atts, $defaults, $raw_atts ) {
// Don't override manually-set number of columns
if ( ! empty( $raw_atts['columns'] ) ) {
return $atts;
}
$atts['columns'] = 4;
return $atts;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment