Display element based on 'post'

Support General Display element based on 'post'

Viewing 15 posts - 16 through 30 (of 43 total)
  • Author
    Posts
  • #1346
    Tan NguyenTan Nguyen
    Participant

    Did you have anoter Group field or other Meta Boxes?

    #1347
    carassiuscarassius
    Participant

    Yes, I have loads.

    This is the full code for my quote cpt

    https://pastebin.com/YiLH0HWv

    #1348
    carassiuscarassius
    Participant

    If it is to hard, or beyond the scope of support to help me out, just let me know, no probs

    Thank You for everything so far, I do appreciate your time.

    Jon

    #1349
    Tan NguyenTan Nguyen
    Participant

    Hi Jon, I found another problem on your code:

    
    // start customer
    $meta_boxes[] = array(
    

    You can remove [], it just $meta_box.

    On step value, can you please change to full value contains zero sign, 0.01 instead of 'step' => .01?

    If you still get error, try to comment out some other Meta Box (I though is Groups), to check what meta boxes generate error 🙂

    #1350
    carassiuscarassius
    Participant

    removing square brackets, [] breaks my site completely

    #1351
    Tan NguyenTan Nguyen
    Participant

    I means only remove square bracket only with $meta_box below, like my example in the previous page.

    
    // start customer
    
    #1352
    carassiuscarassius
    Participant

    Warning: Illegal string offset 'title' in C:\wamp\www\wordpress\wp-content\plugins\project52\plugins\meta-box\inc\meta-box.php on line 343

    Warning: Invalid argument supplied for foreach() in C:\wamp\www\wordpress\wp-content\plugins\project52\plugins\meta-box\inc\meta-box.php on line 386

    Warning: Invalid argument supplied for foreach() in C:\wamp\www\wordpress\wp-content\plugins\project52\plugins\meta-box\inc\meta-box.php on line 150

    #1353
    carassiuscarassius
    Participant

    Dont mind the errors, it is because I removed the square brackets, but left it as

    // start customer
        $meta_boxes = array(

    instead of

    // start customer
        $meta_box = array(
    #1354
    Tan NguyenTan Nguyen
    Participant

    Oh, sorry, remove the square bracket and keep it $meta_box because I have assign $meta_boxes[] = $meta_box later 😉

    #1355
    carassiuscarassius
    Participant

    Fixed the errors, but my phone field still doesnt appear

    #1356
    carassiuscarassius
    Participant

    Ok, the new phone text input area is pulling the correct id: p52_quote_phone_3722 (with 3722 being the select contact post ID), however it is not displaying any value

    #1357
    carassiuscarassius
    Participant

    here is how I have all my contact metaboxes setup..No boxes appear until I select a name, and then they all become visible under the "New" inputs ie this email

    // Show this email field if match name.
                $meta_box['fields'][] = array(
                    'name'        => 'New Email',
                    'id'      => $prefix . 'email_' . $customer->ID,
                    'type'        => 'text',
                    'std'         => get_post_meta( $customer->ID, 'p52_quote_email', true ),
                    'visible'     => array( $prefix . 'name', $customer->ID ),
                    'columns' => 6
                );

    This is the full contact php

    https://pastebin.com/FSGCMCHJ

    #1358
    carassiuscarassius
    Participant

    so the question becomes, why is it displaying with no value?

    <input type="text" class="rwmb-text" name="p52_quote_phone_3762" id="p52_quote_phone_3762" value="" placeholder="" size="30">

    #1359
    Tan NguyenTan Nguyen
    Participant

    Can you please check the database (wp_postmeta) to see the records exists here?

    Basically, it grabs value from postmeta table and bind to meta box as I defined in this line:

    
     'std' 		=> get_post_meta( $customer->ID, 'p52_quote_phone', true ),
    

    So if the customer has phone entered, this should be bound to field via std key.

    I'm very happy to see you're going to the last steps 🙂 This is a great challenge 😀

    #1360
    carassiuscarassius
    Participant

    yes they are in the database eg

     meta_id: 943
    post_id: 3722
    meta_key: p52_contact_phone
    meta_value: 123456789
Viewing 15 posts - 16 through 30 (of 43 total)
  • The topic ‘Display element based on 'post'’ is closed to new replies.