• Hello,

    how can I change the default settings of the gallery?

    I’ve already tried it in wc-gallery/includes/functions.php but it doesn’t work:

    extract(shortcode_atts(array(
    		'order'      => 'ASC',
    		'orderby'    => 'menu_order ID',
    		'id'         => $post ? $post->ID : 0,
    		'captions'   => 'hide',
    		'captiontype' => 'p',
    		'columns'    => 4,
    		'gutterwidth' => '5',
    		'link'       => 'post',
    		'size'       => 'thumbnail',
    		'targetsize' => 'large',
    		'display'    => 'masonry',
    		'customlink' => 'false',
    		'bottomspace' => 'default',
    		'hidecontrols' => 'false',
    		'newtab' => 'false',
    		'class'	     => '',
    		'include'    => '',
    		'exclude'    => ''
    	), $attr, 'gallery'));

    Thanks in advance!

    https://www.ads-software.com/plugins/wc-gallery/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter orvokki

    (@orvokki)

    anyone?:(

    Hi orvokki,

    Any luck setting the default? I too wish to do this.

    Thread Starter orvokki

    (@orvokki)

    Hi, sorry for such a late response.

    Columns and linking are default WP options thus I added the following code to functions.php:

    function theme_gallery_defaults( $settings ) {
        $settings['galleryDefaults']['columns'] = 4;
        $settings['galleryDefaults']['link'] = 'file';
        return $settings;
    }
    add_filter( 'media_view_settings', 'theme_gallery_defaults' );

    When it comes to other settings, they are to be found in the plugin’s files. For example, to hide captions you have to change wc-gallery\includes\functions.php (line 521):

    <label class="setting">
    			<span><?php _e( 'Captions', 'wc_gallery' ); ?></span>
    			<select class="captions" name="captions" data-setting="captions">
    				<?php foreach ( $captions as $key => $value ) : ?>
    					<option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, 'onhover' ); ?>><?php echo esc_html( $value ); ?></option>
    				<?php endforeach; ?>
    			</select>
    		</label>

    chanage ‘onhover’ to ‘hide’

    Disadvantage: will work till the next update… ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change default settings’ is closed to new replies.