Forum Replies Created
-
AuthorPosts
-
carassius
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(carassius
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
carassius
Participantremoving square brackets, [] breaks my site completely
carassius
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
carassius
Participantcarassius
ParticipantI keep getting that foreach error on line 81
carassius
ParticipantThanks Tan, I am still trying to break down your code and get it to work, can I ask another question?
In my contact post type, my prefix for the phone is p52_contact_ to give me the id p52_contact_phone, and given that nothing is working (field not being shown nor any value in it) I am assuming something in here is wrong
// Save data to phone field add_action('rwmb_before_save_post', function($post_id) { // Get person ID to save from "Select a Customer" field $person_to_save = intval( $_POST['p52_quote_name'] ); // Save related field to phone field $_POST['p52_quote_phone'] = $_POST['p52_quote_phone_' . $person_to_save]; // Unset all hidden fields foreach ( $_POST as $key => $value ) { if ( strpos( $key, 'p52_quote_phone_' ) ) unset( $_POST[$key] ); } } );carassius
ParticipantJust redownloaded my core plugins and added that version, and the error is now gone, maybe a corrupt download
carassius
Participantalso, if I do a var_dump ($customers) I dont get any of the metabox fields, so I must have something wrong with loading them into the loop when creating my cpt
carassius
ParticipantWarning: Invalid argument supplied for foreach() in C:\wamp\www\wordpress\wp-content\plugins\project52\plugins\meta-box-conditional-logic\inc\class-conditional-logic.php on line81
this is how i am installing it
if( !class_exists( 'MB_Conditional_Logic' ) ) {
include( plugin_dir_path( __FILE__ ) . '/plugins/meta-box-conditional-logic/meta-box-conditional-logic.php');
}carassius
ParticipantI get an error installing conditional logic
carassius
ParticipantWarning: Invalid argument supplied for foreach() in C:\wamp\www\wordpress\wp-content\plugins\project52\plugins\meta-box-conditional-logic\inc\class-conditional-logic.php on line81
carassius
ParticipantCant seem to get my head around how I can use the conditional logic.
I can see how it makes different elements visible but that is now what I am after (unless I am thinking this wrong?)
I want to look at the post selector
$name = rwmb_meta( 'p52_quote_name', 'type=text' );
and then take that and return the associated phone number to that contact
$phone = rwmb_meta( 'p52_contact_phone', 'type=text' );So I could have something sort of like this (which is totally incorrect, I know)
<?php
function p52_register_quote_meta_boxes( $meta_boxes ) {
$prefix = 'p52_quote_';
$meta_boxes[] = array(
'id' => $prefix . 'customer',
'title' => 'Customer Info',
'pages' => 'p52-quote',
'context' => 'normal',
'priority' => 'low','fields' => array(
array(
'name' => 'Name',
'id' => $prefix . 'name',
'type' => 'post',
'post_type' => 'p52-contact',
'placeholder' => 'Select a Customer',
'columns' => 6
),array(
'name' => 'Phone',
'id' => $prefix . 'phone',
'post_type' => 'p52-contact',
'std' => get_post_meta($post->ID, 'p52_quote_phone', true),
'type' => 'text',
'columns' => 6
),
return $meta_boxes;
}add_filter( 'rwmb_meta_boxes', 'p52_register_quote_meta_boxes' );
carassius
ParticipantOk, will try and see if I can get it to work and come back if I have any questions ๐
Thanks
Joncarassius
ParticipantGot it
$images = rwmb_meta( 'p52_gallery_image', 'type=image' );
if ($random == 'true') {
shuffle($images);
}
foreach ( $images as $image ) {}
-
AuthorPosts