Problem: I have a repeating image field in my Edit Post Form. I would like to display the images horizontally instead of vertically, but when I add the following CSS it changes the display of all repeating fields:
I would like to only use this style for repeating images.
Solution: Add a wrapping div with a CSS class like "rcc-img-edit" around the repeating image cred-field shortcode. Then target that ancestor in your CSS selector:
Problem: I would like to add related parent post information to the response of a REST API endpoint for the child post type.
Solution: Use the following custom code as a guide for adding related post information in a custom registered field in your REST API response for the child post type:
add_action( 'rest_api_init', 'create_api_posts_meta_field_promociones');
function create_api_posts_meta_field_promociones() {
register_rest_field( 'promociones', 'parent-page', array(
'get_callback' => 'get_parent_page_for_api_promociones',
'schema' => null,
)
);
}
function get_parent_page_for_api_promociones( $object ) {
//get the id of the post object array
$post_id = $object['id'];
//return the related comercio post ID
return toolset_get_related_post( $post_id, 'comercio_promocion', 'parent');
}