Forum Replies Created
-
AuthorPosts
-
November 13, 2022 at 10:19 PM in reply to: Issues displaying blog post author name and comment counts #39115
James
ParticipantHi, Peter.
Thanks for your reply but my problem here is I don't know how I can add the author and comments count via views.
November 11, 2022 at 4:39 AM in reply to: Doesn't display list when I set this to the field multiple #39065James
ParticipantThe meta field adder doesn't show the for loop. It's good now. Thanks
James
ParticipantHi, Long. Sorry, I'm having a hard time translating some php code to this twig template, can you give me a sample where I can show post title and its related category? Thank you.
James
ParticipantWow! Great! Thanks soo much 🙂
James
ParticipantThanks, Long.
James
ParticipantHope you can help me with this.
James
ParticipantHi, Long. Here it is. Can you help me display all the custom fields in the email? Including the group and its items. Thanks in advanced.
<?php add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' ); function your_prefix_function_name( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => __( 'Get Price', 'your-text-domain' ), 'id' => 'get-price', 'post_types' => ['page', 'post'], 'style' => 'seamless', 'class' => 'getprice-form', 'fields' => [ [ 'type' => 'heading', 'name' => __( 'Route', 'your-text-domain' ), ], [ 'name' => __( 'From', 'your-text-domain' ), 'id' => $prefix . 'ws_getprice_from', 'type' => 'select_advanced', 'options' => [ 'alesund' => __( 'Ålesund (Norway)', 'your-text-domain' ), 'averoy' => __( 'Averøy (Norway)', 'your-text-domain' ), 'bremerhaven' => __( 'Bremerhaven (Germany)', 'your-text-domain' ), ], 'placeholder' => __( 'Port & Place', 'your-text-domain' ), 'required' => true, 'columns' => 5, 'class' => 'ws-getprice-from', ], [ 'id' => $prefix . 'custom_html_sann48gtpha', 'type' => 'custom_html', 'std' => '<button type="button" class="from-to__flip" tabindex="-1" aria-label="Flip from and to"><svg width="25px" height="20px" viewBox="0 0 25 20" class="icon icon--flip"><g><line class="icon__line" x1="14.2" y1="6.5" x2="2.2" y2="6.5"></line><polyline class="icon__line" points="6.5,12 1,6.5 6.5,1"></polyline><line class="icon__line" x1="10.6" y1="13.5" x2="22.6" y2="13.5"></line><polyline class="icon__line" points="18.4,8 23.9,13.5 18.4,19"></polyline></g></svg></button>', 'columns' => 2, ], [ 'name' => __( 'To', 'your-text-domain' ), 'id' => $prefix . 'ws_getprice_to', 'type' => 'select_advanced', 'options' => [ 'alesund' => __( 'Ålesund (Norway)', 'your-text-domain' ), 'averoy' => __( 'Averøy (Norway)', 'your-text-domain' ), 'bremerhaven' => __( 'Bremerhaven (Germany)', 'your-text-domain' ), ], 'placeholder' => __( 'Port & Place', 'your-text-domain' ), 'required' => true, 'columns' => 5, 'class' => 'ws-getprice-to', ], [ 'name' => __( 'Containers', 'your-text-domain' ), 'id' => $prefix . 'ws_getprice_container_type_group', 'type' => 'group', 'clone' => true, 'add_button' => __( 'Add container type', 'your-text-domain' ), 'fields' => [ [ 'name' => __( 'Container Type', 'your-text-domain' ), 'id' => $prefix . 'ws_getprice_container_type_select', 'type' => 'select_advanced', 'options' => [ 45 => __( '45\' dry container', 'your-text-domain' ), 40 => __( '40\' dry container', 'your-text-domain' ), 20 => __( '20\' dry container', 'your-text-domain' ), '45-reefer' => __( '45\' reefer (refrigiated)', 'your-text-domain' ), '20-feet-flat-rack' => __( '20\' flat rack', 'your-text-domain' ), '40-feet-flat-rack' => __( '40\' flat rack', 'your-text-domain' ), '40-feet-flat-rack-high' => __( '40\' flat rack high cube', 'your-text-domain' ), ], 'placeholder' => __( 'Select container type', 'your-text-domain' ), 'columns' => 8, 'class' => 'ws-getprice-container-group', ], [ 'name' => __( 'Number', 'your-text-domain' ), 'id' => $prefix . 'ws_getprice_quantity', 'type' => 'number', 'columns' => 4, 'class' => 'ws-getprice-quantity', ], [ 'id' => $prefix . 'ws_getprice_ticks', 'type' => 'checkbox_list', 'options' => [ 'empty' => __( 'empty', 'your-text-domain' ), 'dangerous-goods' => __( 'Dangerous goods', 'your-text-domain' ), ], 'inline' => true, 'class' => 'ws-getprice-ticks', ], [ 'name' => __( 'UN Number', 'your-text-domain' ), 'id' => $prefix . 'ws_getprice_un_number', 'type' => 'text', 'placeholder' => __( 'UN0000', 'your-text-domain' ), 'tooltip' => [ 'icon' => 'dashicons-info', 'position' => 'top', 'content' => 'Please provide the UN number', ], 'class' => 'ws-getprice-un-number', 'hidden' => [ 'when' => [['ws_getprice_ticks', 'not contains', 'dangerous-goods']], 'relation' => 'or', ], ], ], ], [ 'name' => __( 'Your Email', 'your-text-domain' ), 'id' => $prefix . 'ws_getprice_email', 'type' => 'email', 'desc' => __( 'Your e-mail will only be used for this purpose. Read our privacy policy for how we take care of your data.', 'your-text-domain' ), 'placeholder' => __( '[email protected]', 'your-text-domain' ), 'size' => 4, 'required' => true, ], [ 'name' => __( 'Additional Information (Optional)', 'your-text-domain' ), 'id' => $prefix . 'ws_getprice_additional_information', 'type' => 'textarea', 'class' => 'ws-getprice-additional-information', ], ], 'validation' => [ 'rules' => [ $prefix . 'ws_getprice_from' => [ 'required' => true, ], $prefix . 'ws_getprice_to' => [ 'required' => true, ], ], 'messages' => [ $prefix . 'ws_getprice_from' => [ 'required' => 'Origin is required', ], $prefix . 'ws_getprice_to' => [ 'required' => 'Destination is required', ], ], ], ]; return $meta_boxes; }James
ParticipantHi, I don't have problems showing the item, my problem is how can I put an if statement inside a loop or condition if it is empty.
{% for clone in post.upload_documents %} {% for item in clone.project_documents %} {% if item.url is empty %} <h3>empty</h3> {% else %} <h3>{{ item.url }}</h3> {% endif %} {% endfor %} {% endfor %}James
ParticipantHi, Long. Thanks for the reply.
I also tried that but still doesn't work. So basically the
upload_documentsis a group id for the first loop and the fields inside it are theproject_documents. What I want to achieve is to see, if data ofproject_documentsis empty then do something if not then do this. Thanks in advance.Here's my custom fields setup:
<?php add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' ); function your_prefix_function_name( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => __( 'Project Details', 'your-text-domain' ), 'id' => 'project-details', 'post_types' => ['project'], 'geo' => [ 'api_key' => 'AIzaSyCxo8eTReDw2Ehp9zYovWw4W9VRwEsD8Cs', ], 'fields' => [ [ 'id' => $prefix . 'custom_html_2avzqnhkuwl', 'type' => 'custom_html', 'std' => 'To upload images in this project, please go to the right sidebar and find the Project Image.', ], [ 'name' => __( 'Project Documents', 'your-text-domain' ), 'id' => $prefix . 'upload_documents', 'type' => 'group', 'collapsible' => true, 'save_state' => true, 'group_title' => '{project_documents}', 'clone' => true, 'sort_clone' => true, 'clone_as_multiple' => true, 'add_button' => __( 'Upload more', 'your-text-domain' ), 'before' => __( 'מסמכי הפרויקט', 'your-text-domain' ), 'fields' => [ [ 'name' => __( 'Add Thumbnail Icon', 'your-text-domain' ), 'id' => $prefix . 'document_icon', 'type' => 'single_image', ], [ 'name' => __( 'Add Document', 'your-text-domain' ), 'id' => $prefix . 'project_documents', 'type' => 'file_advanced', 'max_file_uploads' => 1, ], ], ], [ 'name' => __( 'Project Address', 'your-text-domain' ), 'id' => $prefix . 'project_address_bar', 'type' => 'text', 'before' => __( 'כתובת הפרויקט', 'your-text-domain' ), ], [ 'name' => __( 'Project Map', 'your-text-domain' ), 'id' => $prefix . 'project_map_group', 'type' => 'group', 'before' => __( 'מפת הפרויקט', 'your-text-domain' ), 'fields' => [ [ 'name' => __( 'Address Name', 'your-text-domain' ), 'id' => $prefix . 'address_name', 'type' => 'text', 'before' => __( 'כתובת', 'your-text-domain' ), ], [ 'name' => __( 'Map', 'your-text-domain' ), 'id' => $prefix . 'osm_map', 'type' => 'osm', 'address_field' => 'address_name', 'language' => 'en', 'region' => 'il', 'before' => __( 'מַפָּה', 'your-text-domain' ), ], ], ], ], ]; return $meta_boxes; }October 4, 2021 at 1:32 AM in reply to: ✅Open Street Map: Unable to scroll to the bottom with fullwidth map #31126James
ParticipantHi, Long. Is this the correct call In functions.php?
function my_map() { $args = array( 'width' => '640px', 'height' => '480px', 'js_options' => array( 'doubleClickZoom' => false, 'scrollWheelZoom' => false, ) ); echo RWMB_Map_Field::render_map( 'osm_map', $args ); }In the views
{{ mb.my_map() }}James
ParticipantHi, Long. Yes there is always an error "Google Maps JavaScript API error: InvalidKeyMapError".
James
ParticipantHere's the curre6nt ma6 fields
<?php add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' ); function your_prefix_function_name( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => __( 'Project Details', 'your-text-domain' ), 'id' => 'project-details', 'post_types' => ['project'], 'geo' => [ 'api_key' => 'AIzaSyCxo8eTReDw2Ehp9zYovtWw4W9VRwEsD8Cs', ], 'fields' => [ [ 'name' => __( 'Project Documents', 'your-text-domain' ), 'id' => $prefix . 'upload_documents', 'type' => 'group', 'collapsible' => true, 'save_state' => true, 'group_title' => 'Document', 'clone' => true, 'clone_as_multiple' => true, 'add_button' => __( 'Upload more', 'your-text-domain' ), 'fields' => [ [ 'name' => __( 'Add Document', 'your-text-domain' ), 'id' => $prefix . 'project_documents', 'type' => 'file_advanced', 'max_file_uploads' => 1, ], [ 'name' => __( 'Add Thumbnail Icon', 'your-text-domain' ), 'id' => $prefix . 'document_icon', 'type' => 'single_image', ], ], ], [ 'name' => __( 'Map', 'your-text-domain' ), 'id' => $prefix . 'map_b5umjtee1s7', 'type' => 'map', 'api_key' => 'AIzaSyCxo8eTReDw2Ehp9zYovWw4W9VRwEsD8Cs', 'std' => '9.025299452651655, 125.2054629738509', 'address_field' => 'address_name', 'region' => 'il', ], [ 'name' => __( 'Address Name', 'your-text-domain' ), 'id' => $prefix . 'address_name', 'type' => 'text', ], ], ]; return $meta_boxes; }James
ParticipantI already enabled the wp debug and set it to true in wp-config.php but there are no hints or errors showing. I also remove it from the group field and make it as the top field and still doesn't load the map on the frontend.
James
ParticipantHi, Long. Thanks for your patient. I did everything you said above but everything is not working maybe the Metabox plugin will cause conflict in Divi especially when adding a map. Maybe this google map loads twice. Any other suggestions? Thanks
James
ParticipantThanks. Is there a way to convert this into views? Instead of PHP so it is much easier for me to add this to the single.php.
$group_values = rwmb_meta( 'project_address' ); $args = array( 'api_key' => 'AIzaSyCxo8eTReDw2Ehp9zYovWw4W9VRwEsD8Cs' ); echo RWMB_Map_Field::render_map( $group_value['project_google_map'], $args ); -
AuthorPosts