Inventory_Presser_Photo_Numberer::renumber_photos( int $post_id )
renumber_photos
Description
Reassigns sequence numbers to all photos attached to a vehicle post.
Designed to run after a photo is deleted from the middle.
Parameters
- $post_id
-
(int) (Required) The post ID of a vehicle
Return
(void)
Source
File: includes/class-photo-numberer.php
public static function renumber_photos( $post_id ) { // Get all of this vehicle's photos $posts = get_children( array( 'meta_key' => apply_filters( 'invp_prefix_meta_key', 'photo_number' ), 'orderby' => 'meta_value_num', 'post_parent' => $post_id, 'post_type' => 'attachment', ) ); for ( $s = 1; $s <= sizeof( $posts ); $s++ ) { self::save_meta_photo_number( $posts[ $s ]->ID, $post_id, $s ); } }
Expand full source code Collapse full source code View on Github