Display element based on 'post'
- This topic has 42 replies, 3 voices, and was last updated 9 years, 8 months ago by
carassius.
-
AuthorPosts
-
August 31, 2015 at 11:52 AM #1346
Tan Nguyen
ParticipantDid you have anoter Group field or other Meta Boxes?
August 31, 2015 at 11:55 AM #1347carassius
ParticipantAugust 31, 2015 at 11:57 AM #1348carassius
ParticipantIf 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
August 31, 2015 at 12:23 PM #1349Tan Nguyen
ParticipantHi 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 🙂
August 31, 2015 at 12:27 PM #1350carassius
Participantremoving square brackets, [] breaks my site completely
August 31, 2015 at 12:29 PM #1351Tan Nguyen
ParticipantI means only remove square bracket only with $meta_box below, like my example in the previous page.
// start customer
August 31, 2015 at 12:42 PM #1352carassius
ParticipantWarning: 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
August 31, 2015 at 12:57 PM #1353carassius
ParticipantDont 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(
August 31, 2015 at 1:02 PM #1354Tan Nguyen
ParticipantOh, sorry, remove the square bracket and keep it $meta_box because I have assign $meta_boxes[] = $meta_box later 😉
August 31, 2015 at 1:11 PM #1355carassius
ParticipantFixed the errors, but my phone field still doesnt appear
August 31, 2015 at 1:39 PM #1356carassius
ParticipantOk, 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
August 31, 2015 at 1:58 PM #1357carassius
Participanthere 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
August 31, 2015 at 2:02 PM #1358carassius
Participantso 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">
August 31, 2015 at 2:12 PM #1359Tan Nguyen
ParticipantCan 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 😀
August 31, 2015 at 2:24 PM #1360carassius
Participantyes they are in the database eg
meta_id: 943 post_id: 3722 meta_key: p52_contact_phone meta_value: 123456789
-
AuthorPosts
- The topic ‘Display element based on 'post'’ is closed to new replies.