Forum Replies Created
-
AuthorPosts
-
June 24, 2021 at 4:24 PM in reply to: ✅WP_Query Multiple Relationships relation = AND doesn't work ? #29104
Julien
ParticipantI discover this issue since 18 february and still any fix...
Why is so long ?
Julien
Participant@Hazmi : The problem was on meta-box-aio, read my oldest replies
@Long Nguyen : I did update with 1.13.13 and all seems to be fine. Thank you
Julien
ParticipantAdditional info: I use meta-box-aio (meta-box columns enabled)
Julien
ParticipantSame for me since last update of metabox-aio but only on one single website.
I don't use composer on this project, standard wordpress install.April 11, 2021 at 11:35 PM in reply to: ✅WP_Query Multiple Relationships relation = AND doesn't work ? #27156Julien
ParticipantHi,
1 month since my last answer.
Any news ?
Julien
Participant<?php if ( ! isGutenbergElement( logic[0] ) && ! dependentFieldSelector && !compare(logic[0], ')', 'contains') ) { return; }instead of
<?php if ( ! isGutenbergElement( logic[0] ) && ! dependentFieldSelector ) { return; }It could be a real fix ?
March 10, 2021 at 3:48 PM in reply to: ✅WP_Query Multiple Relationships relation = AND doesn't work ? #24815Julien
ParticipantHello,
have you been able to look at this ?
Sorry to insist but it's a little bit problematic for me.
March 1, 2021 at 4:18 PM in reply to: ✅WP_Query Multiple Relationships relation = AND doesn't work ? #24671Julien
ParticipantHello,
thanks,
I did a video record with a quick sample test code.
https://www.youtube.com/watch?v=0gqSSPWWUZ4
https://gist.github.com/harkor/23a53e40a53908d6de98d505241cc6a8Thank you
Julien
ParticipantI found a more sexiest solution.
It's a continuation of my reply
Explanations:
I coded a custom field type based on select_advanced (see documentation).
This custom field type named "select_advanced_ajax"
The gist is in two part
1 - Creation of a Meta Box with a custom Class (MetaBoxClass.php)
2 - Our custom field type declaration (RWMB_Select_advanced_ajax_Field.php)When the field is saved, we add in the database the hidden field.
My code : https://gist.github.com/harkor/2fad09a642a096eb0a48984669211312
I didn't want create a javascript file for that because it's make a third file.
Feel free to adapt.
If the support team have a better solution give it to me 😀
Julien
ParticipantAnother solution (without ajax) is populate the options array in PHP but this code execute each loading page of WordPress (front and back).
So we need to make conditions to populate only when we edit page but in case we have a large set or the populate function is long to fill, it's not a good solution.
Sample code here
Julien
ParticipantCorrection
After some research, the value is in database but the select is empty on the backend.So I found an hack but it's not really sexy.
You can find adaptation here
My "temporary" solution is setting 2 more fields
1 - html field for jquery script
2 - hidden field to option value for select2When select_advanced field change, hidden field is updated with values of select_advanced
When the page load, we populate select_advanced with the hidden fieldYou can maybe adapt "select_advanced" to detect when we are in ajax situation and populate with an hidden_field like I did ?
Julien
ParticipantAdditional informations
For this test, if Meta Box AIO disabled, problem still persist.
Julien
ParticipantThanks for your response but I did the trick on my first reply. Did you see it ?
For the code on your reply, you didn't read code correctly, if the render_callback exist, the function render_callback is called and then stop because you have a "return;"
Julien
ParticipantWe could maybe add information about render_template into the "set_block_data" function as follow ?
Base
private function set_block_data( &$attributes ) { $attributes['name'] = $this->id; $data = isset( $attributes['data'] ) ? $attributes['data'] : []; $this->storage->set_data( $data ); ActiveBlock::set_block_name( $this->id ); }Into
private function set_block_data( &$attributes ) { $attributes['name'] = $this->id; $attributes['render_template'] = $this->render_template; $data = isset( $attributes['data'] ) ? $attributes['data'] : []; $this->storage->set_data( $data ); ActiveBlock::set_block_name( $this->id ); }Julien
ParticipantI found a solution with the render_callback, do you think it's possible to get the render_template value inside the callback ?
With this value I can make only one render_callback for all of my custom blocks.
There is the current solution for someone who need it
public function my_hero_callback($attributes, $is_preview = false, $post_id = null){ if (file_exists(get_theme_file_path("views/blocks/hero.blade.php"))) { echo \App\template("blocks.hero", [ 'attributes' => $attributes, 'is_preview' => $is_preview, 'post_id' => $post_id ]); } } -
AuthorPosts