PHPackages                             wearerequired/gallery-types - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wearerequired/gallery-types

ActiveWordpress-plugin[Utility &amp; Helpers](/categories/utility)

wearerequired/gallery-types
===========================

Allows you to define a theme specific gallery type.

1.0.1(8y ago)02.9k↓91.7%GPL-2.0+PHP &gt;=5.6

Since May 10Compare

[ Source](https://github.com/wearerequired/gallery-types)[ Packagist](https://packagist.org/packages/wearerequired/gallery-types)[ Docs](https://github.com/wearerequired/gallery-types)[ RSS](/packages/wearerequired-gallery-types/feed)WikiDiscussions Synced 1w ago

READMEChangelogDependenciesVersions (3)Used By (0)

Gallery Types
=============

[](#gallery-types)

A plugin that allows you to define a theme specific gallery type. Props to [Jetpack for their Gallery module](https://github.com/Automattic/jetpack/blob/4.6/functions.gallery.php).

Add custom gallery types
------------------------

[](#add-custom-gallery-types)

By default the plugin supports only one type, WordPress default thumbnail grid. To add more types you can use the `gallery_types.types` filter.

```
add_filter( 'gallery_types.types', function( $types ) {
	return array_merge( $types, [
		'slider' => [
			'label' => __( 'Slider', 'gallery-types' ),
			'supports_columns' => false,
		],
	] );
} );
```

Each type has a key (`slider`) with two values: `label` for the label displayed in the select menu and `supports_columns` to define whether the type supports columns. If `supports_columns` is set to false the columns option will be hidden.
Once a user selects a type the shortcode will get a new `type` attribute with the key of a gallery type as value.

To change the default selected type you can use the `gallery_types.default-type` filter.

### Customize gallery output

[](#customize-gallery-output)

This plugin does not change the ouput of the gallery shortcode. That needs to be part of your theme and could be something like this:

```
/**
 * Customizes the gallery shortcode output if the type attribute is set to 'slider'.
 *
 * @see gallery_shortcode()
 *
 * @param string $output The gallery output. Default empty.
 * @param array  $attr   Attributes of the gallery shortcode.
 * @return string HTML content to display gallery.
 */
function required_gallery_shortcode( $output, $attr ) {
	$is_slider = false;

	// Check if the type attribute is set.
	if ( isset( $attr['type'] ) && 'slider' === $attr['type'] ) {
		$is_slider = true;
	}

	// Return the default gallery if the type attribute isn't set.
	if ( ! $is_slider ) {
		remove_filter( 'post_gallery', 'required_gallery_shortcode', 10 );
		$output = gallery_shortcode( $attr );
		add_filter( 'post_gallery', 'required_gallery_shortcode', 10, 2 );
		return $output;
	}

	// Override shortcode attributes.
	$attr['size']    = 'thumbnail';
	$attr['link']    = 'file';
	$attr['columns'] = 0;

	// Get default gallery output and wrap it in a custom container div.
	remove_filter( 'post_gallery', 'required_gallery_shortcode', 10 );
	$output = gallery_shortcode( $attr );
	add_filter( 'post_gallery', 'required_gallery_shortcode', 10, 2 );

	return "$output";
}
add_filter( 'post_gallery', 'required_gallery_shortcode', 10, 2 );
```

Contributing
------------

[](#contributing)

### Build Task

[](#build-task)

To update the minfied JavaScript file you need Node.js installed.

```
# to install dependencies run:
npm install

# to update the file run:
npm run build

```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~247 days

Total

2

Last Release

3129d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1446895?v=4)[required](/maintainers/wearerequired)[@wearerequired](https://github.com/wearerequired)

---

Top Contributors

[![ocean90](https://avatars.githubusercontent.com/u/617637?v=4)](https://github.com/ocean90 "ocean90 (14 commits)")

---

Tags

wordpressgalleryslider

### Embed Badge

![Health badge](/badges/wearerequired-gallery-types/health.svg)

```
[![Health](https://phpackages.com/badges/wearerequired-gallery-types/health.svg)](https://phpackages.com/packages/wearerequired-gallery-types)
```

###  Alternatives

[aristath/kirki

Extending the WordPress customizer

1.3k73.1k4](/packages/aristath-kirki)[afragen/git-updater

A plugin to automatically update GitHub, Bitbucket, GitLab, or Gitea hosted plugins, themes, and language packs.

3.3k1.8k](/packages/afragen-git-updater)[tacowordpress/tacowordpress

WordPress custom post types that feel like CRUD models

232.2k](/packages/tacowordpress-tacowordpress)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
