I have created a page called "Gallery" and created new gallery
with 10 images. My page id is 129. I have 10 images in that page id(129)
.
Now my question is, i need a code to fetch those 10 images in wordpress. please anyone help me with a code. Thanks in advance.
相关问题
- Display product ACF field value in Woocommerce tra
- Adding a custom button after add to cart button in
- How to add a “active” class to a carousel first el
- Setting custom order statuses as valid for payment
- change the font size in tag cloud
相关文章
- wordpress新增页面如何个性化设置
- select query in wordpress
- Get WooCommerce featured products in a WP_Query
- Woocommerce update shipping methods in checkout vi
- Change order status just after payment in WooComme
- Publishing or uploading failed. Error message: “Th
- Facebook Login With WP JWT Auth
- Wordpress development process
Use get_children
I used this code to extract all the images from a page gallery in the chosen order. you can include this code in the loop or use it stand alone. just choose the appropriate post_parent code (see bellow the code example).
This example show all images associated to the page id 129, have a look:
$images is now a object that contains all images (related to post id 1) and their information ordered like the gallery interface.
Find the post id you wan to extract images from and insert it into this argument: 'post_parent' => 129
you can also use:
'post_parent' => $post->ID If you want to use get_children in a loop, and get the post id from the returned post id.
If you want to exclude the image selected as a featured image i would have a if statement check if the image URL is equal to the featured image URL.
Get all images from post.
Here you get frist image such like you get all other images