Featured Galleries

Featured Galleries

توسط

Hello Theme Developers!

Have you ever added a Featured Image to a post and thought to yourself, “I wish I could add more than one image this way”? Well, now you can. Featured Galleries mirrors the Featured Images functionality of WordPress. The only difference is that posts get an entire gallery rather than just a single image. These galleries behave almost exactly like Featured Images, and make use of WordPress’s built in Media Manager. Users can select images, define the order, and save the gallery, all through a simple drag-n-drop interface.

Note: This plugin DOES NOT HANDLE THE FRONTEND HTML CREATION. That is left for themes to handle, to allow for maximum flexibility. Featured Galleries just handles the backend/admin interface for creating featured galleries and storing them as metadata. You will need to integrate this into your theme, or use a theme with prebuilt integration.

Quick Start Guide to Integrate Into Themes

For more information, see GitHub Wiki.

I’ve tried to make this as intuitive as possible. Themes can integrate Featured Galleries in the same way they integrate Featured Images. Inside any template file where the gallery should appear, the theme will call the get_post_gallery_ids() function. As long as it is used inside the loop, the function doesn’t need any parameters. By default, it will return an array of image IDs.

Example

Set inside the Loop. This returns all images in the Featured Gallery, as an array, then loops through to display each using an HTML <img> tag.

$galleryArray = get_post_gallery_ids(); 

foreach ( $galleryArray as $id ) {

    echo '<img src="' . wp_get_attachment_url( $id ) .'">';

}

You can also customize the returned value from the function to suit your needs. See the full function documentation page for details.

Custom Post Types

The plugin comes with a filter to easily add Featured Galleries to custom post types. See the fg_post_types documentation page for details.

Customizing the Media Manager

The media manager can be customized in sevearl ways. See the fg_show_sidebar and fg_use_legacy_selection filter documentation pages for details.

Want to Help?

I’d love some help with internationalization. It was working at one point, but drivingralle did that code because I don’t really understand it, and I’m not sure it’s still working.

There are two ways to install this plugin.

Manual:

  1. Upload the featured-galleries folder to the /wp-content/plugins/ directory
  2. Go to the ‘Plugins’ menu in WordPress, find ‘Featured Galleries’ in the list, and select ‘Activate’.

Through the WP Repository:

  1. Go to the ‘Plugins’ menu in WordPress, click on the ‘Add New’ button.
  2. Search for ‘Featured Galleries’. Click ‘Install Now’.
  3. Return to the ‘Plugins’ menu in WordPress, find ‘Featured Galleries’ in the list, and select ‘Activate’.

سوالات متداول

Installation Instructions

There are two ways to install this plugin.

Manual:

  1. Upload the featured-galleries folder to the /wp-content/plugins/ directory
  2. Go to the ‘Plugins’ menu in WordPress, find ‘Featured Galleries’ in the list, and select ‘Activate’.

Through the WP Repository:

  1. Go to the ‘Plugins’ menu in WordPress, click on the ‘Add New’ button.
  2. Search for ‘Featured Galleries’. Click ‘Install Now’.
  3. Return to the ‘Plugins’ menu in WordPress, find ‘Featured Galleries’ in the list, and select ‘Activate’.

What is the point of this?

I was tasked to update a Featured Projects page for a client website. Projects were a custom post type, and the page displaying them used a special WP_Query. Each Project had a featured image. The client wanted each to have several images that could be clicked through with arrows. I couldn’t find an easy way to accomplish this, so I built it from scratch. A friend suggested I abstract it into a plugin to share.

Will it be improved?

Yes. The next step on my roadmap is to figure out how to do a one time re-keying of all data to start with an underscore, so that it’s invisible.

Can I add a featured gallery to my custom post type?

Why yes you can! You don’t even have to edit the plugin to do so. There are details on how to do this in the Instructions.

×
نظری برای این آیتم موجود نیست.
0 0 رای ها
امتیازدهی
اشتراک در
اطلاع از
0 نظرات
قدیمی‌ترین
تازه‌ترین بیشترین رأی
نسخه حجم فایل SHA256 تغییرات دانلود
2.1.0 14 کیلوبایت -
دانلود
×
★★★★★
★★★★★
4.7 /5 (20 نظر)

قیمت:

رایگان

نگارش

2.1.0

آخرین انتشار

12 اردیبهشت 1405

آخرین بروزرسانی

4 ماه پیش

نصب های فعال

3,000+

نگارش وردپرس

وردپرس 3.8.0+

تست شده از نسخه

وردپرس 4.9.29

نگارش PHP

PHP 5.4+

نسخه ها

1 نسخه