function mpp_get_previous_gallery_id($gallery_id) { if (!$gallery_id) { return false; } $gallery = mpp_get_gallery($gallery_id); $args = array('component' => $gallery->component, 'component_id' => $gallery->component_id, 'object_id' => $gallery->id, 'next' => false); $prev_gallery_id = mpp_get_adjacent_object_id($args, mpp_get_gallery_post_type()); return $prev_gallery_id; }
function mpp_get_previous_media_id($media_id) { if (!$media_id) { return false; } $media = mpp_get_media($media_id); $args = array('component' => $media->component, 'component_id' => $media->component_id, 'object_id' => $media->id, 'object_parent' => $media->gallery_id, 'next' => false); $prev_gallery_id = mpp_get_adjacent_object_id($args, mpp_get_media_post_type()); return $prev_gallery_id; }