Changeset 1916640
- Timestamp:
- 07/29/2018 10:22:40 PM (7 years ago)
- File:
-
- 1 edited
-
featured-galleries/trunk/readme.txt (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
featured-galleries/trunk/readme.txt
r1916638 r1916640 20 20 **Note**: This is not a plugin which will add galleries to your website. This is for theme developers. It handles the backend interface for creating featured galleries, and storing them. You will still need to build a gallery on your page templates. 21 21 22 = --Instructions -- =22 = --Instructions to Integrate Into Themes-- = 23 23 24 24 Just like with Featured Images themes will need to call a Featured Gallery in any template file where the Featured Gallery should appear. I've tried to make this as intuitive as possible. … … 26 26 Just like WordPress comes with `get_post_thumbnail_id()` built-in, you can use `get_post_gallery_ids()` to call the Featured Gallery. As long as it is used inside the loop, it doesn't need to be passed any parameters. In that case, by default, it will return a PHP array with the ID's of all images in the post's Featured Gallery. However, you can also customize the returned value to suit your needs, with up to three parameters. 27 27 28 get_post_gallery_ids( $postID, $maxImages, $returnType ); 29 28 30 **Parameters:** 29 30 $galleryArray = get_post_gallery_ids( $postID, $maxImages, $returnType );31 31 32 32 * $postID: … … 53 53 = --Examples-- = 54 54 55 Example 1: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.55 **Example 1:** 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. 56 56 57 57 $galleryArray = get_post_gallery_ids(); … … 63 63 } 64 64 65 Example 2:Set inside the Loop. This behaves exactly the same as Example 1, it just has all parameters specifically set to their defaults, to demonstrate what is happening.65 **Example 2:** Set inside the Loop. This behaves exactly the same as Example 1, it just has all parameters specifically set to their defaults, to demonstrate what is happening. 66 66 67 67 $galleryArray = get_post_gallery_ids( null, -1, 'array' ); … … 73 73 } 74 74 75 Example 3:Set inside the Loop. This returns the first two images in the Featured Gallery, as an array, then loops through to display each using an HTML `<img>` tag.75 **Example 3:** Set inside the Loop. This returns the first two images in the Featured Gallery, as an array, then loops through to display each using an HTML `<img>` tag. 76 76 77 77 $galleryArray = get_post_gallery_ids( null, 2 ); … … 83 83 } 84 84 85 Example 4:Set outside the Loop. This uses a specified post ID (431) and returns all images in that post's Featured Gallery, as an array, then loops through to display each using an HTML `<img>` tag.85 **Example 4:** Set outside the Loop. This uses a specified post ID (431) and returns all images in that post's Featured Gallery, as an array, then loops through to display each using an HTML `<img>` tag. 86 86 87 87 $galleryArray = get_post_gallery_ids( 431 ); … … 93 93 } 94 94 95 Example 5:Set inside the Loop. This returns all images in the Featured Gallery, as an string, then echos that string to the page. I personally don't see how returning the IDs as a string is useful, but it was requested as a feature a long time ago.95 **Example 5:** Set inside the Loop. This returns all images in the Featured Gallery, as an string, then echos that string to the page. I personally don't see how returning the IDs as a string is useful, but it was requested as a feature a long time ago. 96 96 97 97 $galleryString = get_post_gallery_ids( null, -1, 'string' );
Note: See TracChangeset
for help on using the changeset viewer.