Forum Replies Created
-
AuthorPosts
-
November 21, 2020 at 6:10 AM in reply to: ✅best approach when it comes to query by custom field #22956
Brian
ParticipantHi Logn,
My query & order by custom date field is not working.Since my date fields are within a group field, and it's the group field that's cloneable what would be the key and value so that my query is ordered by my the custom date field?
My group id is: ct_event_date_group
And my event date field id is: ct_event_dateHere is what I have but it's not working:
// Events Query $events_query = new WP_Query(array( 'post_type' => 'event', 'posts_per_page' => -1, 'meta_key' => 'ct_event_date_group', 'orderby' => 'meta_value', 'order' => 'DESC' ));November 20, 2020 at 7:23 AM in reply to: ✅best approach when it comes to query by custom field #22937Brian
ParticipantHi Long,
So I just realized that my date fields are within a group and the group is cloneable. So does that mean the 'clone_as_multiple' feature will not work because it's in a group? I have a few other fields that I needed to associate to the date fields that's why I had then in a group.Thanks,
BrianNovember 19, 2020 at 10:59 AM in reply to: ✅best approach when it comes to query by custom field #22911Brian
ParticipantHi Long,
Thanks for that info as I wasn't aware of the 'clone_as_multiple' option. Will this work if the fields are in a MB Custom Table?Thanks,
BrianBrian
ParticipantHi Long,
Thanks - I'll give give this a go.It might be nice to just add this into the meta box plugin css itself. That way it would span to full width of whatever column selection you add. What do you guys think?
Thanks,
BrianBrian
ParticipantHi Long,
Thanks for the reply and pointing me to rwmb_get_field_settings()I'm getting close but still have a few errors. Is this the correct approach for displaying the labels instead of the value in a select advanced dropdown field?
// Return Select Advanced field labels $field = rwmb_get_field_settings('dgp_holiday_availability'); $options = $field['options']; // Get all labels $values = rwmb_meta('dgp_holiday_availability'); $labels = array_map( function( $value ) use ( $options ) { return $options[$value]; }, $values ); // Output labels if ( $values = rwmb_meta( 'dgp_holiday_availability' ) ) { foreach ( $labels as $label ) { $new_content .= '<li><span class="holiday-details-label">Availability:</span>' .esc_html( $label ) . '</li>'; } }Brian
ParticipantHi Anh,
I'm getting the same error. Did you all find a solution? I can't figure out why the conditional logic isn't adding in the style="display:none;" or "display:block;" to show/hide fields?I created everything in a different site which has the "MB Builder" plugin activated and the conditional logic works on that site. But as soon as I copy the exact code to a different site and install the required "conditional logic" plugin. It does not work. I've tried to find what would be different between sites and can't find much?
What am I missing here?
Thanks,
BrianBrian
ParticipantHi Long,
That worked - thank you!Brian
ParticipantHi Long,
Thanks for the fast reply.The only issue now is that If I select the first form in dropdown and check the ID it outputs it always gives it a "0" id/value. But the id of the first GForm is "1" not zero. If I select the second form option in dropdown and save. The value is "1", but the form id is really "2".I'm wondering if I need to add a "Select a form" placeholder text within the dropdown field so that it takes the "0" value?
Thoughts, what do you suggest? - hope I explained correctly.
Thanks for your help!
Brian
ParticipantHi Long,
I spoke too soon. It is listing available Gravity Forms in the dropdown.But it's not saving a value. For example if I select a form option other than the "first" in dropdown and save, when I go back to check the field it always displays the "first" form in listing. But it's not saving any value to output.
What do you think is missing?
Thanks in advance!
Brian
ParticipantHi Long,
Thank you for the detailed reply. I see now what you did - creating a new select field. Makes sense and all is working. I'm good to go!Thanks again!
Brian
ParticipantHi Anh or Mark,
I need to do something similar. I have a "Select Advanced" dropdown field that I would like to populate with specific Gravity Forms, based on the form id. I reviewed the above links but still a little confused.Here is what I have so fare.
if ( class_exists( 'RWMB_Field' ) ) { class RWMB_GFSelect_Field extends RWMB_Field { $forms = RGFormsModel::get_forms(1,2,3); $options = array(); foreach ($forms as $form) { $options[$form->id] = $form->title; } return $options; } }Am I creating a new select advance field or just extending it and telling it to pull in the specific gf forms? Not understanding.
Thanks in advance!
Brian
ParticipantHi Long,
Thanks for the detailed reply and providing the js show/hide option. I didn't realize that what I was originally trying to do based on your docs was only for the backend field display. Makes sense now.I'm all good - thanks again!
Brian
ParticipantHi Long,
Wow you're right parsing in url does look super complex.I'll just add it into template output as you suggested in first option. One question though. I created a radio option field before the two book now url fields. So that the user could select an internal link vs external link. I set up the conditional logic in metabox and everything is working. I then added two book now buttons in output (one for external and one for internal) each with own css class.
I thought I'd be able to hide of the the booking buttons based on the radio fields value on the front-end of website. I followed your documentation and created new filter:
// Conditionally Hide Internal Reservation Button add_filter( 'rwmb_outside_conditions', function( $conditions ) { $conditions['.onsite-booking-url'] = array( 'hidden' => ['tour_reservation_link_option', '=', 'external'], ); return $conditions; } );But this did not work. Both buttons display on front end of site. Am I missing something?
Thanks in advance!
Brian
ParticipantHi Long,
I reached out to Gravity Forms. They said to ask you all if it's possible to parse the shortcodes that I'm using above in the url field? Because you need them to parsed before passing them to Gravity Forms.Is that more clear? How would I be able to parse those shortcode values so that I can use them in my reservation url custom field?
Thanks in advance!
Brian
ParticipantHi Long,
I'm not sure I explained it correctly. So I provided a screenshot: https://share.getcloudapp.com/DOu8ODZDI made a custom post type of "trips" and have a handful of custom fields on the edit page like in above screenshot. What I would like to do is get to two custom field values and use them in my reservation url field as seen in screenshot. So that on the front end of the site when a user clicks the button - the url will have those two values added to the end as a query string so that it will dynamically populate a Gravity Form "field" when they get directed to that page from link.
Let me know - Thanks!
-
AuthorPosts