Support Forum » User Profile

Forum Replies Created

Viewing 15 posts - 4,816 through 4,830 (of 4,839 total)
  • Author
    Posts
  • in reply to: Custom field value in query string? #18830
    Long NguyenLong Nguyen
    Moderator

    Hi Brian,

    Parsing a shortcode in the URL is very complicated. It's very easy if you modify your code like this

    <a href="https://demo.com/?your_parameter=<?php echo do_shortcode('[rwmb_meta id="tour_date"]') . do_shortcode('[rwmb_meta id="tour_name"]') ?>">Button</a>

    This piece of code will help you to parse the shortcode in the URL when clicking to the button, but only one shortcode will be parsed.
    https://demo.com/?your_parameter=[rwmb_meta id="tour_date"]

    You can use Code Snippet to run the code and you need to find the class of the button to put on the code.

    Long NguyenLong Nguyen
    Moderator

    Hi,

    Please take a look at my screen record.

    The fields do not have any value but after clicking Publish, the table still shows as well as the button download above. Remove attribute state or set to false then refresh and update the product again to see the result.

    in reply to: Unique value of Text field on a whole site #18821
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Unfortunately, the plugin Meta Box does not support to check/validate the value in a field is unique or not. But you can use the post ID of WordPress itself (unique) to concatenate with your field value when printing out on the front end

    echo rwmb_meta('field_id') . get_queried_object_id();

    Long NguyenLong Nguyen
    Moderator

    Hi,

    Because you've enabled the attribute save_state so the file attachments always return an array $file_attachments = rwmb_meta( 'file_attachments' );

    This attribute means when you add more groups but not put any name or file, it will save the last state when publishing the product. Take a look at my screenshot https://cl.ly/e883f5d356f2

    Change the attribute 'save_state' => false and refresh your site, the button will not display if there are empty fields in the first group.

    in reply to: Custom field value in query string? #18813
    Long NguyenLong Nguyen
    Moderator

    Hi Brian,

    If you are using the shortcode outside the loop (or the post), you should add the second attribute object_id then the shortcode should be

    [rwmb_meta id="field_id" object_id="post_id"]

    you can find the post ID in the URL when editing the post

    For further information, please follow our documentation
    https://docs.metabox.io/shortcode/

    in reply to: post Excerpt #18805
    Long NguyenLong Nguyen
    Moderator

    If you use the field as the excerpt, please change the ID of the field to excerpt instead of content, take a look at my screenshot

    in reply to: Export / Import #18804
    Long NguyenLong Nguyen
    Moderator

    Hi Nuno,

    WordPress supports to export the custom post type by going to Admin Dashboard -> Tools -> Export -> Post types

    in reply to: post Excerpt #18801
    Long NguyenLong Nguyen
    Moderator

    So strange, on my local site the field textarea display as well as WYSIWYG
    https://cl.ly/66366ab23a1a
    https://cl.ly/69ac21a36317

    After changing the position of the field, please try to clear the cache and check the field again.

    in reply to: post Excerpt #18797
    Long NguyenLong Nguyen
    Moderator

    Hi B,

    The field can work any position before or after title, content. As I can see in your first and second images, the field is WYSIWYG type but the third is textarea type. Could you please check it out?

    in reply to: Get Password meta field #18788
    Long NguyenLong Nguyen
    Moderator

    The password, in essential, that means remember not to store in a field. These articles maybe help you to secure the argument
    https://blog.httpwatch.com/2009/02/20/how-secure-are-query-strings-over-https/
    https://fastspring.com/docs/passing-sensitive-data-with-secure-requests/

    in reply to: Metaboxes for Nav Menu Items #18781
    Long NguyenLong Nguyen
    Moderator

    Hi Johann,

    WordPress 5.4 introduces the new hook to add custom fields to the menu item, we are discussing and researching for this feature in the future update.

    Keep this plugin up to date and you will have more control over your site.

    in reply to: Get Password meta field #18776
    Long NguyenLong Nguyen
    Moderator

    Hi,

    A password after saving to the database, it is hashed and can only be checked by the function.
    https://codex.wordpress.org/Function_Reference/wp_hash_password

    So if you want to save the API password, it should be a Text field with a string then you can send this string when connecting to API as an argument.

    Long NguyenLong Nguyen
    Moderator

    I have a CPT name Customer File and create three text fields (number, address, phone) as the code below

    add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' );
    
    function your_prefix_register_meta_boxes( $meta_boxes ) {
        $prefix = '';
    
        $meta_boxes[] = array (
            'title' => esc_html__( 'Customer info', 'text-domain' ),
            'id' => 'customer-info',
            'post_types' => array(
                0 => 'customer-file',
            ),
            'context' => 'normal',
            'priority' => 'high',
            'fields' => array(
                array (
                    'id' => $prefix . 'name',
                    'type' => 'text',
                    'name' => esc_html__( 'Name', 'text-domain' ),
                ),
                array (
                    'id' => $prefix . 'address',
                    'type' => 'text',
                    'name' => esc_html__( 'Address', 'text-domain' ),
                ),
                array (
                    'id' => $prefix . 'phone',
                    'type' => 'text',
                    'name' => esc_html__( 'Phone', 'text-domain' ),
                ),
            ),
        );
    
        return $meta_boxes;
    }

    then use this code to show the list invoices and the customers name

    $invoices = array(
        array(
            'customernumber' => '101',
            'invoicenumber'   => 1,
            'invoiceamount'   => 100
        ),
        array(
            'customernumber' => '213',
            'invoicenumber'   => 2,
            'invoiceamount'   => 95
        ),
        array(
            'customernumber' => '107',
            'invoicenumber'   => 3,
            'invoiceamount'   => 107
        )
    );
    
    $args = array(  
        'post_type' => 'customer-file',
        'post_status' => 'publish',
        'posts_per_page' => -1, 
    );
    
    $loop = new WP_Query( $args ); 
        
    while ( $loop->have_posts() ) : $loop->the_post(); 
        foreach ( $invoices as $number => $invoice ) {
            if( $invoice['customernumber'] == $loop->post->post_title ) {
                echo 'Customer Number: ' . $invoice['customernumber'] . '<br>';
                echo 'Invoice Number: ' . $invoice['invoicenumber'] . '<br>';
                echo 'Invoice Amount: ' . $invoice['invoiceamount'] . '<br>';
                echo 'Name: ' . rwmb_meta( 'name' ) . '<br>';
                echo 'Address: ' . rwmb_meta( 'address' ) . '<br>';
                echo 'Phone: ' . rwmb_meta( 'phone' ) . '<br>';
    
            }
        }
    endwhile;
    
    wp_reset_postdata(); 

    Please see my screen record to make sense https://cl.ly/3fd58b9a803b

    Long NguyenLong Nguyen
    Moderator

    Hi James,

    Could you please share the structure of the Invoices array? Assume that the invoices return the array like this and you can use the for loop to get the name of the customer

    $invoices = array(
        array(
            'name' => 'John',
            'price'   => 10
        ),
        array(
            'name' => 'Marry',
            'price'   => 20
        ),
        array(
            'name' => 'Doe',
            'price'   => 30
        )
    );
    
    foreach ( $invoices as $number => $invoice ) {
        if( $invoice['name'] == $your_query->post->post_title /*John*/ ) {
            echo 'the price is: ' . $invoice['price'];
            // echo rwmb_meta('your_field_id');
        }
    }
    in reply to: Bug: image module does not safe on mobile #18758
    Long NguyenLong Nguyen
    Moderator

    Hi,

    I've added your code in my demo site then login with a user and upload an image via mobile phone, everything is working fine. You can take a look in here.

Viewing 15 posts - 4,816 through 4,830 (of 4,839 total)