php - How to create galleries for wordpress posts without plugin -
I want to create a gallery for my posts to work like this:
- I choose the pictures WordPress Post-New Page and Upload them
- Wordpress creates an array of uploaded images
- And finally I use that array and I put the gallery in my single.fp file
Actually woocommerce is using the exact thing as you see in the picture ( Ed was not established English WordPress I)
Any suggestions?
<
-
Enter a gallery in the tour post, div class = "post-text" itemprop = "text">
You can use default gallery behavior for your needs
-
This will make a shortcode
[Gallery IDs = "12,45,67,34"]
Make it your post Override the default gallery shortcode function to not display in
remove_shortcode ('gallery', 'gallery_short Check '); Add_shortcode ('Gallery', 'my_gallery'); Function my_gallery () {return ''; }
Retrieve an array of images
$ post_content = get_the_content (); Preg_match ('/ \ [gallery. * Id =. (. *). \] /', $ Post_content, $ id); If ($ id) {$ array_id = explosion (",", $ id [1]); }
-
-
Comments
Post a Comment