-
Notifications
You must be signed in to change notification settings - Fork 1
fg_post_types
Andy Mercer edited this page Aug 2, 2018
·
6 revisions
add_filter('fg_post_types', 'myprefix_change_featured_galleries_post_types' );
This filter allows themes to change the array of post types that Featured Galleries are enabled for. By default, the array includes 'post' and 'page'.
-
$postTypes
:- Type: Array
- Description: An array of post types which featured galleries will be enabled on
- Default Value:
['post','page']
- Possible Values: An array with text values. Any text value which isn't a valid post type will be ignored
Example 1: This example will add Featured Galleries to a custom post type with the slug of 'book'.
function add_featured_galleries_to_books( $postTypes ) {
array_push($postTypes, 'book' );
return $postTypes;
}
add_filter('fg_post_types', 'add_featured_galleries_to_books' );
Example 2: This example will remove Featured Galleries from regular posts.
function myprefix_remove_featured_galleries_from_posts( $postTypes ) {
$postTypes = array_diff($postTypes , ['post'] );
return $postTypes;
}
add_filter('fg_post_types', 'myprefix_remove_featured_galleries_from_posts' );