开发者 |
kelderic
drivingralle |
---|---|
更新时间 | 2018年8月3日 06:31 |
捐献地址: | 去捐款 |
PHP版本: | 5.4 及以上 |
WordPress版本: | 4.9.7 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
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 '';
}
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.
featured-galleries
folder to the /wp-content/plugins/
directoryI 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.
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.
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.
fg_use_legacy_selection
filter. See docs for details.fg_show_sidebar
filter.get_post_gallery_ids()
was called on post with empty Featured Gallery, using an array return (the default), an array containing one string (a comma) was returned instead of an empty array.$oldfix
when running post-MP6 versions of WordPress (3.9 and over). Props Joshuadnelson.