Hello friends, there is a valid type of record, or the main one, this is not the point. It is necessary to add a field to it that will write an array of images uploaded by the user (via the admin interface). In general, this is the whole task)

UPD Noted that requires editing, I will try to add

function my_meta_box() { add_meta_box( 'my_meta_box', 'My Meta Box', 'show_my_metabox', 'post', 'normal', 'high'); } add_action('add_meta_boxes', 'my_meta_box'); $meta_fields = array( array( 'label' => 'Галерея', 'desc' => '', 'id' => 'price', 'type' => 'text' // ?? ) 

In general, the standard code for creating your own data entry field. It is necessary to make it so that this field would accept the link from the images inserted by the user through the standard WP interface for working with media files. Actually interested in how to do it.

UPD2 Perhaps this can somehow be implemented through standard work with galleries wp [gallery ids = "1,2,3"] - is this an array and can it be taken as an array for the theme output? It is only necessary that this array be written to a separate variable in a separate field.

  • I understand the author is interested in the possibility of implementing the same functionality as in the woocommerce plugin, where the product has the opportunity to add pictures to the gallery through the library of media files. He himself thought about this possibility, but so far his hands did not reach to address this issue. It would be interesting if someone answers. - pepel_xD

1 answer 1

In general, there are three options for solving the problem:

1) Put the Visual Composer and insert the gallery. Of the minuses - it’s hard to work, it’s badly scalable.

2) ACF plugin. You buy and insert gallery fields and add them in the admin panel and in the code. From the minuses - you need to code. Here is an example of use:

3) Use regular custom fields and widgets in combination with shortcodes