Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 16 through 30 (of 30 total)
  • Author
    Posts
  • in reply to: Invalid key map error #30848
    JamesJames
    Participant

    I tried to add this in the functions.php but still doesn't load the map.

    $group_values = rwmb_meta( 'project_address' );
    $args = array(
        'api_key' => 'AIzaSyCxo8eTReDw2Ehp9zYovWw4W9VRwEsD8Cs'
    );
    
    echo RWMB_Map_Field::render_map( $group_value['project_google_map'], $args );

    And the setting api_key in the meta box settings is already in lowercase.

    in reply to: Invalid key map error #30831
    JamesJames
    Participant

    I tried it but still doesn't work. Maybe because I'm using Divi with a default google API field?

    $group_values = rwmb_meta( 'project_address_group' );
    $args = array(
        'api_key' => 'AIzaSyCxo8eTReDw2Ehp9zYovWw49sVRwEsD8Cs'
    );

    My custom field

    <?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' => 'AIzaSyCxo8eTReDw2Ehp9zYovWw49sVRwEsD8Cs',
            ],
            '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'   => __( 'Project Address', 'your-text-domain' ),
                    'id'     => $prefix . 'project_address',
                    'type'   => 'group',
                    'fields' => [
                        [
                            'name' => __( 'Address', 'your-text-domain' ),
                            'id'   => $prefix . 'address_field',
                            'type' => 'text',
                        ],
                        [
                            'name'          => __( 'Location', 'your-text-domain' ),
                            'id'            => $prefix . 'project_google_map',
                            'type'          => 'map',
                            'std'           => '9.025299452651655, 125.2054629738509',
                            'address_field' => 'address_field',
                            'language'      => 'iw',
                            'region'        => 'il',
                        ],
                    ],
                ],
            ],
        ];
    
        return $meta_boxes;
    }
    in reply to: Invalid key map error #30764
    JamesJames
    Participant

    Thanks Long!

    How can I do that? I tried adding that but it doesn't work on my end. I'm adding this on MB Views as a shortcode containing this:

    {{ post.project_address.project_google_map.rendered }}

    in reply to: Get selected option in select field and display #29811
    JamesJames
    Participant

    Hi, I tried it but this selected multiple options when I select it.

    <script>
    jQuery(document).ready(function(){
         var current_text = jQuery("#mobile-select :selected").text();
         jQuery('#mobile-select').change(function() {
         jQuery(this).children(':selected').text(current_text + " (current)");
       });
    });
    </script>

    Result

    <select id="mobile-select">
    <option>test 1 (current)</option>
    <option>test 2 (current)</option>
    <option>test 3 (current)</option>
    <option>test 4 (current)</option>
    </select>

    in reply to: Insert group field inside the Tab field items? #29430
    JamesJames
    Participant

    Can this be duplicated and sorted?

    JamesJames
    Participant

    i tried this as well

    {% set args = { post_type: 'dish', nopaging: true} %}
    {% set dishes = mb.get_posts( args ) %}
    {% for dish in dishes %}
    
        {% for clone in post.add_menu %}
        {% for clone in clone.add_dishes %}
            {{ clone.title }}
        {% endfor %}
        {% endfor %}
    
    {% endfor %}
    JamesJames
    Participant

    Hi I tried this but all the dishes are all added. I just want the dishes that are only added from store page using the custom fields post.

    {% set args = { post_type: 'dish', nopaging: true} %}
    {% set dishes = mb.get_posts( args ) %}
    {% for dish in dishes %}
    
        <a href="{{ mb.get_the_permalink( dish.ID ) }}">{{ dish.post_title }}</a>
        {{ mb.rwmb_meta( 'dish_price', '', dish.ID ) }}
    
    {% endfor %}

    Please see this screenshot of the single store page
    https://markuphero.com/share/aicr2tfAqwmQLrF5VOg2

    in reply to: name each of the fields in the clonable group field #29417
    JamesJames
    Participant

    It works. Thank you 🙂

    JamesJames
    Participant

    Yes. You are right. It is added in the single store post type. So basically I want to get the custom post fields from the dish post type by adding them in the single store post type.

    Please see this screenshot of the single store page
    https://markuphero.com/share/aicr2tfAqwmQLrF5VOg2

    I want to get the custom fields from the dish and show them on the front-end. How can I do that? Because right now I'm only limited to these:

    https://markuphero.com/share/7kk9LeMW1C7PIOcmtQ0W

    in reply to: Convert function into view to filter category #29240
    JamesJames
    Participant

    Hi, Metabox. The categories are showing now but the filter doesn't work. Any idea how I can add filter that stays on the page, without loading? In my MB views, I connect the DISH post type to the STOREpost type using the MB Relation and target the single post in STORE. So within that single store post I can add multiple dishes in every single store. Now, I would like to add filter that only show only the category for the dishes that are being added via relation in the store and filter the data without loading the page. Can you help me? Thanks.

    I'm not a coder like you guys 🙁

    Output:
    https://markuphero.com/share/asYRuYmgQnXCXLlnPe3O

    <!-- header image  -->
    {% for post in query.posts %}
        <div class="fullwidth-header" style="background-image:url({{ post.thumbnail.thumbnail.url }}); background-repeat: no-repeat; object-fit: cover; background-position: center;background-size:cover;">
        </div>
    {% endfor %}
    <!-- end header image -->
    
    <!-- dishes wrapper -->
    <div class="nm-dishes-wrap">
        <!-- filter links for category    -->
        <div class="nm-category-filter nm--pointer-underline nm--pointer-overline">
            <ul class="nm-cat-inline">
                {% set terms = mb.get_terms( { taxonomy: 'dish-category' } ) %}
                {% for term in terms %}
                <li><a href="?getby=cat&cat={{ mb.esc_attr( term.slug ) }}" class="nm-item">{{ mb.esc_html( term.name ) }}</a></li>
                {% endfor %}
            </ul>
        </div>
        <!-- List of the dishes to be filter by category -->
        <!-- By default it shows all the dishes specific for specific store   -->
        <div class="nm-dishes">
        {% set relationship = attribute( relationships, 'dish-single-store' ) %}
        {% for post in relationship.from %}
            <!-- card items starts -->
            <div class="nm-dishes--card">
                <div class="nm-dishes--card-header">
                    <h4>{{ post.post_title }}
                    <!-- check if the dish has vegetables -->
                    {% if mb.checkbox( post.dish_vegetable, 'Yes', 'No' ) == 'Yes' %}
                    <span>
                        <img src="/wp-content/uploads/2021/06/nm-vegetable-checker.svg" height="30" weight="auto" class="nm-dish-vegetable"></span>
                    {% else %}   
                    {% endif %}
                        
                    <!-- check if the dish has gluten -->
                    {% if mb.checkbox( post.dish_gluten, 'Yes', 'No' ) == 'Yes' %}
                    <span>
                        <img src="/wp-content/uploads/2021/06/gluten.svg" height="30" weight="auto" class="nm-dish-gluten"></span>
                    {% else %}   
                    {% endif %}
                    </h4>
                    <span class="nm-dishes--price">{{ post.dish_price }}</span>
                </div>
                <div class="nm-dishes--body">
                    <p class="nm-dishes--desc">
                        {{ post.dish_description }}
                    </p>
                    <img src="/wp-content/uploads/2021/06/nm-camera-icon.svg" height="40"  weight="auto" class="icon-camera">
                    <div class="nm-hidden">{{ mb.get_the_post_thumbnail( post.ID, 'medium') }}</div>
                </div>
                <!-- end nm-dishes--body -->
            </div>
            <!-- nm-dishes--card -->
        {% endfor %}
        </div>
        <!-- end nm-dishes -->
    </div>
    <!-- end nm-dishes-wrap -->
    <?php
    add_action( 'mb_relationships_init', 'your_prefix_function_name' );
    
    function your_prefix_function_name() {
        MB_Relationships_API::register( [
            'id'   => 'dish-single-store',
            'from' => [
                'object_type'   => 'post',
                'post_type'     => 'dish',
                'empty_message' => 'No connection',
                'admin_column'  => [
                    'position' => 'after title',
                    'title'    => 'Stores',
                    'link'     => 'view',
                ],
                'meta_box'      => [
                    'title'    => 'Add Store',
                    'context'  => 'normal',
                    'priority' => 'high',
                    'closed'   => true,
                ],
                'field'         => [
                    'name'       => 'Add dishes',
                    'add_button' => 'Add more dishes',
                ],
            ],
            'to'   => [
                'object_type'   => 'post',
                'post_type'     => 'store',
                'empty_message' => 'No connection',
                'admin_column'  => [
                    'position' => 'after title',
                    'title'    => 'Dishes',
                    'link'     => 'view',
                ],
                'meta_box'      => [
                    'title'    => 'Add Dishes',
                    'context'  => 'normal',
                    'priority' => 'high',
                ],
                'field'         => [
                    'name'       => 'Connect store',
                    'query_args' => [
                        '5fv72mho16w' => [
                            'id'    => '5fv72mho16w',
                            'key'   => '',
                            'value' => '',
                        ],
                    ],
                    'add_button' => 'Add more dish',
                ],
            ],
        ] );
    }
    in reply to: Convert function into view to filter category #29070
    JamesJames
    Participant

    I want to add a button category that filters data on the view. Is this possible?

    in reply to: Convert function into view to filter category #29068
    JamesJames
    Participant

    Hi, where do I place this? This doesn't work with my view.

    <div class="filter-custom-taxonomy">
        <?php
        $terms = get_terms( 'publisher' );
        foreach ( $terms as $term ) : ?>
        <a href="?getby=cat&cat=<?php echo esc_attr( $term->slug ); ?>">
                <?php echo esc_html( $term->name ); ?>
        </a>
        <?php endforeach; ?>
    </div>
    in reply to: Content doesn't show #29053
    JamesJames
    Participant

    Thanks you 🙂

    in reply to: Relationships Usage #27459
    JamesJames
    Participant

    Thank you 🙂

    in reply to: Hierarchical filter #27423
    JamesJames
    Participant

    Hi, I got an error.

    Warning: Use of undefined constant ‘justread_filter_archive’ - assumed '‘justread_filter_archive’' (this will throw an Error in a future version of PHP) in /home/kirbkobs/main.mywebsite.com/wp-content/themes/Thedemozone/functions.php on line 52

Viewing 15 posts - 16 through 30 (of 30 total)