Forum Replies Created
-
AuthorPosts
-
September 10, 2021 at 10:46 PM in reply to: Field ID not being updated, data can't be pulled, can't use MB #30699
AnLip
ParticipantHi,
Thanks for reply.
Actually the problematic field is not the
image-advancedtype, but thesingle_imagetype. It corresponds to the field I have named "dlc_media_photos_couverture". Can you help me with this one ?I will, nevertheless try your suggestion concerning the other type of field.
September 9, 2021 at 10:57 PM in reply to: Field ID not being updated, data can't be pulled, can't use MB #30686AnLip
ParticipantI get the same problem on another group of fields, where I can pull all the necessary data correctly, apart from the single image that doesn't show.
I recorded a short screen video of the problem, can I upload it here ? How ?September 9, 2021 at 10:49 PM in reply to: Field ID not being updated, data can't be pulled, can't use MB #30685AnLip
ParticipantHi,
This the PHP code generated through the WP back-office builder. All fields can be succesfully pulled, apart from the single image "dlc_media_photos_couverture".
FYI "dlc_media_photos_choix" corresponds to an Advanced Image field, where we can upload a gallery of images.
<?php add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' ); function your_prefix_function_name( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => __( 'Médias-Photos-Fields', 'your-text-domain' ), 'id' => 'medias-photos', 'post_types' => ['media-photo'], 'fields' => [ [ 'name' => __( 'Titre de la galerie', 'your-text-domain' ), 'id' => $prefix . 'dlc_media_photos_titre', 'type' => 'text', 'label_description' => __( 'Titre à donner à la galerie (peut être le même que le titre de la publication)', 'your-text-domain' ), 'placeholder' => __( 'Concert de Marseille', 'your-text-domain' ), 'required' => true, ], [ 'name' => __( 'Image en couverture', 'your-text-domain' ), 'id' => $prefix . 'dlc_media_photos_couverture', 'type' => 'image_advanced', 'label_description' => __( 'Image à utiliser en couverture de la galerie', 'your-text-domain' ), 'max_file_uploads' => 1, 'required' => true, 'image_size' => 'medium', 'max_status' => false, ], [ 'name' => __( 'Choix d\'images à montrer', 'your-text-domain' ), 'id' => $prefix . 'dlc_media_photos_choix', 'type' => 'image_advanced', 'label_description' => __( 'Choisir la/les photo(s) à grouper dans cette galerie', 'your-text-domain' ), 'required' => true, 'max_status' => false, ], [ 'name' => __( 'Date de l\'évènement', 'your-text-domain' ), 'id' => $prefix . 'dlc_media_photos_date', 'type' => 'date', 'label_description' => __( 'Date de l\'évènement', 'your-text-domain' ), ], [ 'name' => __( 'Lieu', 'your-text-domain' ), 'id' => $prefix . 'dlc_media_photos_lieu', 'type' => 'text', 'label_description' => __( 'Lieu de l\'évènement', 'your-text-domain' ), ], [ 'name' => __( 'Crédits photographiques', 'your-text-domain' ), 'id' => $prefix . 'dlc_media_photos_credits', 'type' => 'text', 'label_description' => __( 'Personnes à créditer pour les photos', 'your-text-domain' ), ], ], ]; return $meta_boxes; }AnLip
ParticipantEDIT : I have found a workaround using Oxygen Builder, using the new Advanced Query function. But I believe some still might want to have a clear example of code applying to changing a date format and ordering query results by meta_key value.
Thank you if you can take the time
AnLip
ParticipantHello Long,
I am having trouble finding the correct code to change date format to "dd month" AND have the month show in French.
For the moment I am using this code :
$meta = rwmb_meta( 'dlc_agenda_date' );
$meta = get_post_meta( get_the_ID(), 'dlc_agenda_date', true );
echo date_i18n( 'j F', $meta );but it is pulling the actual date (the date it is today, whatever the date), not the value from my meta_key "dlc_agenda_date" as I would like it to...
Please let me know what I am not doing right...
September 9, 2021 at 4:04 PM in reply to: Field ID not being updated, data can't be pulled, can't use MB #30678AnLip
ParticipantHello Long, thank you for your quick response.
I figured out in the meantime that I needed to re-save the custom post type posts individually to erase the content of the old meta_keys. So by opening again the custom posts individually, the fields had become blank (after renaming their IDs), and by re-entering the data field by field, it would remove the old meta_keys no longer in use, and replace them with the new ones, and allow me to pull them. Another way round was to just copy/paste the meta_key ID without trying to find it in the list, as Oxygen allows that.
So now my fields are correctly populated, but I do have an issue with Single Images that do not want to come, I have no idea why. A broken image thumbnail pictogram shows (Chrome), no way to have it show up. Should I open another thread for this question ? Thank you in advance for your help.
A.
-
AuthorPosts