Forum Replies Created
-
AuthorPosts
-
December 15, 2022 at 12:46 AM in reply to: wpd bzw. query vars --> order by --> MB Custom Table #39804
jw_bln
ParticipantOk, understood - so it is not possible to use Metabox Custom Table and Bricksbuilder (and most likely Oxygenbuilder too) as Metabox custom table cannot support "orderby" parameter inside WP_Query.
As said, oderby in SQL is not sufficient...
THIS IS NOT WORKING:
// SQL to get relevant post-ID's (specific MB table)
global $wpdb, $ids;
$ids = $wpdb->get_col( " SELECT id FROM table WHERE select_category = 'xxx' ORDER BY MB_field DESC " );
// filter bricks custom loop
add_filter( 'bricks/posts/query_vars', 'custom_query', 10, 3 );
function custom_query( $query_vars, $settings, $element_id ) {
global $ids;
// apply only to #id of looping div
if ($element_id == 'xxxxx') {
// query vars
$query_vars['post__in'] = $ids;
return $query_vars;
}
}December 14, 2022 at 4:33 PM in reply to: wpd bzw. query vars --> order by --> MB Custom Table #39778jw_bln
ParticipantBTW: using print_r I see that the SQL itself is working and I am able to order those entries..
But looping through ordered WP_Query entries is not working, the related answer from them:
My QUESTION: ORDER BY is working (see the result of print_r). BUT: in Frontend no ordering takes place.
ANSWER Brisksbuilder: This is correct, those are 2 different querires, so order by in query 1 (SQL based) will not bring over to query in Bricks query.December 14, 2022 at 4:26 PM in reply to: wpd bzw. query vars --> order by --> MB Custom Table #39777jw_bln
ParticipantHi,
based on your answer I was asking the guys at Bricksbuilder.
I want to loop trough the Metabox meta fields (which is not an issue) AND order it based on such a Metabox meta field stored in the automatically created table.
They say Metaabox this:
" If your CPT is created using Metabox Custom Table, I am afraid they might not support WP_Query orderby parameter."Please confirm 100% that your Plugin is able to order any custom field (based on MB Custom Table).
Thanks in advance.jw_bln
ParticipantHi,
I spoke about "transform".All SVG's are already in the media library; so there is no need to have it in the DB.
Image single also exists.
ONLY the output format is missing in MB.You simply can use PHP functions require or include in your code base to be able to output the content.
This is my simple example, maybe you have a better approach:
<?php function svg_include($file_name, $site_url) { $file = $site_url . '/wp-content/uploads/' . $file_name . '.svg'; $output = require ($file); return $output; } ?>I would like to use this function.
But unfortunately, this is not possible in certain situations ;-(
That's the reason why I am asking - I think it would bring MB also a benefit, without much effort...jw_bln
ParticipantI tried the following:
- Created custom table via UI/interface (so ALL fields are text)
- Changed one field in the DB from text to varchar(10)
- afterwards updated the field (e.g. to put a new field to the custom fields form)
Result: ALL formats of all fields are reset now in the DB to text again.
So updating does not to be as safe as you indicate.Maybe I am missing something?
Can I store the field format somewhere in the UI, so it will be applied correctly (and NOT changed)?
The documentation says nothing in this regards.
Is there an autocheck if I have only 10 chars?
Thanks for your clarification.October 8, 2022 at 3:38 PM in reply to: link not working - How to Create a Product Page - P3 - Using Meta Box + Bricks #38593jw_bln
ParticipantAlso another small question:
What is the intention of this setting:
Edit Field Group > Settings > Position = ...Before/After post title.
a) where are all the settings documented
b) I thought in the Edit/Add post type mask the custom fields would be shown after the title (and not the original post content visual/text editor) - but this is not the case.jw_bln
ParticipantHi Long,
OK, thanks for the information given 😉
So, in my use case unfortunately not possible to use.
Best regards.jw_bln
ParticipantOhh, was looking around - did not find... Thanks.
Maybe you add a small hint to the text field description...jw_bln
ParticipantSeems to be OK now, thanks.
What was the background?jw_bln
ParticipantI got even a white screen of death after the update! So I had to go to DB to fix and deactivate MB...
jw_bln
ParticipantCan be closed, thanks.
jw_bln
ParticipantUnfortunately also not working (same error-message / red field) - please can you show an example of how it works in the graphical UI?
As no pictures are possible to add, I can not show the result - only describe it...
I am doing it in "Taxonomies = category".Copde generated:
<?php add_filter( 'rwmb_meta_boxes', 'your_prefix_register_meta_boxes' ); function your_prefix_register_meta_boxes( $meta_boxes ) { $prefix = ''; $meta_boxes[] = [ 'title' => esc_html__( 'Category_Order', 'text-domain' ), 'id' => 'Category_order', 'fields' => [ [ 'id' => $prefix . 'M_category-orderID', 'type' => 'number', 'name' => esc_html__( 'Category Order ID', 'text-domain' ), 'required' => 1, 'tooltip' => 'defines order priority', 'admin_columns' => [ 'position' => 'before name', 'sort' => true, ], ], [ 'id' => $prefix . 'text_sb532j9yqc', 'type' => 'text', 'name' => esc_html__( 'Text Field', 'text-domain' ), 'pattern' => '[0-9]{3}-[0-9]{3}-[0-9]{3}', ], ], 'taxonomies' => ['category'], ]; return $meta_boxes; }jw_bln
ParticipantHi Long,
thanks, I see.
Is it OK to ask in two weeks again?
Please let the ticket open for this period of time.And only to understand the intention of this extension (sorry if I am dumb or unaware):
Using a separate DB makes a lot of sense, e.g. performance, maintainability, etc.
But what is a typical use case if the retrieved data cannot be ordered or selected by using meta_query?
Maybe I am missing something...
I mean, of course, I can use other frameworks like React, Vue, etc. if I want to have complete control (by doing a lot of coding), but this is a completely different story...jw_bln
ParticipantHi Long,
many thanks (!), now I was able to successfully looping through the custom posts.
I extended the function with the WP-core $get_the_ID, so it's not static / hard-coded.
Sometimes it's not easy to get all information out of the documentation; I have read intensively but was not able to get the solution.jw_bln
ParticipantThanks for your detailed answer.
But still I believe there is a misunderstanding in the concept behind and some questions.
So first of all let me short explain:
I have a single table created – as you already know, without any content stored.
As you can see on the second image below: I created the content type “Square”, so a WordPress user can create or change the content.The next images give you an idea: I am using a Repeater on each web page to show the content of those “Squares” (a single DB row each).
Only a filter is set in the repeater-query to get only the relevant content. More or less the whole page is created by this custom fields content.
The content itself will be shown by clicking on a Square – no additional page will be opened for details (so there is not a special page (with page ID).
The content is not page related; it’s like a car overview of a car-dealer (but without the need to have a single page for each of the cars).Question/Topic 1:
Therefore I assume using a content type “Page” does not achieve the goal…
In addition, by switching to “Page” a user cannot create or change the content using WordPress if you now click on “Squares” and open e.g. “Test2” no fields of the DB are shown anymore because you changed now to “Page”.
This was the reason I chose not post type = ”page”.
I followed the guide “Using existing tables”.Question/Topic 2:
Regarding fixed table name: Of course you are correct. Not sure, most likely the Oxygen Support changed it by trying to help. Or maybe I made a mistake…
I am using a fixed table name (no dynamic ones).Question/Topic 3:
Regarding the function.php There is no theme used by Oxygen page builder – so you will not find it in the mentioned php-file.
But using the plugin “Snippets” is working, otherwise it would have not been possible for me to extract the content from the custom table.
So it is possible to call the metabox helper functions as well as my own ones.Question/Topic 3:
Regarding picture shown (this was the main question):
If you click in the structure pane on the image (within the repeater) you can see that I am using the function.
By clicking on data-button you can use the php function.
But still I cannot see the picture rendered on the frontend (or on the backend) – so still there is no success currently ;-(Thanks for your feedback
-
AuthorPosts