WPIntell

Source evidence

Bricks Builder compatibility

Panda Pods Repeater Field · support · 2023-04-06T14:52:00+00:00

mixedsentiment
mediumseverity
0.85relevance
25replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

2 / 19 rows with source links

10.5% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

17 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
dizplay resolved
I’m trying to make the contents of a repeater appear in bricks, without success. Does anyone have any tips or guides? I see that the plugin unfortunately isn’t compatible with bricks query loop (PODS is, the plugin not). as Bricks is becoming the ultimate web design tool, it would be interesting to make this gem of a plugin compatible. Hi, @dizplay . Thanks for being interested in the plugin. I understand, but Bricks is not free. If you ask the Bricks team, they probably will give you a license number valid for your development. They already did with other plugin devs. I can try. How do you want to use the plugin? Backend or Frontend? Both. The issue is that when creating a query loop on backend, the Type won’t show the panda repeater, but only Posts, terms and users. Other plugin (like ACF, Metabox, ACPT) displays also the repeater field in this dropdown. So, Pods is ok, and your plugin it’s even better, it lacks only to be available here. Hi, @dizplay . OK. Thanks to Bricks, I got a copy. I am new to Bricks. How do I get to that screen? Do you have a pods json package for me to import? FANTASTIC NEWS! Bricks guys are really awesome. if you pm me temp admin, I’ll create a tipical scenario. Or you can create the usual Books post type in Pods, with a panda repeater on it, with some images and links in a repeater for a single book. Then have a look here https://academy.bricksbuilder.io/article/query-loop/ Basically on frontend you should create a container with some dynamic data on it (the Flash icon on fields) Like the picture on previous message, Activating the query loop (on the container element that should be repeated) on the post type dropdown you should have also the repeater, if present on the page. @dizplay Sorry, I don’t to want publish an admin login details. I need more instructions. Do I do these: Create an advance content type for the repeater field (what is the name of the advance content type?) Create a table based Book post type Create a panda repeater field to use the advance content type Which page do I need to edit? Install Pods and Panda. Enable “Advanced content type” and ‘Tablke storage’ as per yours tutorials. This is a JSON structure for a custom post type called Books https://pastebin.com/gthr7y7s import it on Pods. in WP admin open Bricks > template, create a new template for SINGLE page, click “edit” it with bricks, copy the pastebin code from https://pastebin.com/grhu5xqh and paste it on the paste icon on the top of the structure panel (right darkgray column on bricks editor interface). With template open, click the cog on the left top and assign the template to the “Books” post type (see here https://i.imgur.com/G6lgBdP.png ) last: create a Book post: on More fields you will find some singolar content (Singolar image, title, gallery) and after a repeader group, with Name and PDF). Fill the singular content and a couple of Chapters (mine https://i.imgur.com/Jb1flDw.png ) After that you can view the book public page (it uses the book template). So, the issue is that on template, the Post type do not show the repeater group (to count how many repeated groups and multiply the relative div on frontend) Thanks for the detailed instructions. Can it be a shortcode in functions.php, and then add the shortcode to the template? During editing the template (bricks interface) you find the Shortcode element on the left colum. Click it and position it where you like on the page. When is selected you see its properties, where you can write the classic Shortcode with square brackets. It’s also possible to use the echo php command: https://academy.bricksbuilder.io/article/dynamic-data/ @dizplay I tried to pass the post id into the shortcode, but {post_id} always returns 1. Do you know how to get the current page ID? {post_id} is correct. Be sure to be previewing the real post, and not the template. I couldn’t get the correct post_id to pass into the shortcode. You know Bricks, would you give it a go? Here is the shortcode: function display_book_chapters( $id ){ $chapters = pods_field( 'book', $id, 'chapter' ); foreach( $chapters as $i => $chapter ){ echo '<div>'; echo $chapter['name']; $pdf_url = wp_get_attachment_url( $chapter['pdf'] ); if( $pdf_url ){ echo '<a href="' . $pdf_url . '">PDF</a>'; } echo '</div>' ; } } add_shortcode( 'display_book_chapters', 'display_book_chapters' ); Use it in the template: [display_book_chapters id={post_id}] This reply was modified 2 years, 11 months ago by Coding Panda . Use it in the template: [display_book_chapters id={post_id}] Using the shortcode i get a warning (but no output): Warning : foreach() argument must be of type array|object, null given in C:\Users\Dee Ego\Local Sites\bricksbuilder\app\public\wp-content\themes\bricks-c\functions.php on line 172 I tries also with a code block (it’s an element like the Shortcode on bricks editor) <?php echo do_shortcode( '[display_book_chapters id="'.$post_id.'"]' ); ?> and in this case i get 2 warnings: Warning : Undefined variable $post_id in C:\Users\Dee Ego\Local Sites\bricksbuilder\app\public\wp-content\themes\bricks\includes\elements\code.php(160) : eval()’d code on line 2 Warning : foreach() argument must be of type array|object, null given in C:\Users\Dee Ego\Local Sites\bricksbuilder\app\public\wp-content\themes\bricks-c\functions.php on line 172 In any case, these solutions would not be ideal, as they do not take advantage of bricks’ internal query system, that is, in making the Repeater appear as a post type in the indicated dropdown. You can update the function to check if the chapters are available. function display_book_chapters( $id ){ $chapters = pods_field( 'book', $id, 'chapter' ); if( ! empty( $chapters ) ){ foreach( $chapters as $i => $chapter ){ echo '<div>'; echo $chapter['name']; $pdf_url = wp_get_attachment_url( $chapter['pdf'] ); if( $pdf_url ){ echo '<a href="' . $pdf_url . '">PDF</a>'; } echo '</div>' ; } } } I think the problem is that {post_id} doesn’t pass in the correct post id into the shortcode. You can test it by echoing {post_id} without the shortcode, and contact Bricks if necessary. I don’t think $post_id can be used before declaring it. You could try {post_id}. the Repeater is not a post type. It is a field of a Pod which can be a post type. Updated functions: warning disappears, but no output. in my case echoing {post_id} results in 336, which is the right one. I also test php code above and also shortcode with hardcoded 336: no warning in this case, but neither the repeated Name/PDF. I know that is not a post type, but the repeater (if present in page) should appears in dropwown: check the ACF version at 14:05 https://www.youtube.com/watch?t=845&v=72zSZ6AOU6Y Is 336 an ID of a book page? in my case, yes I noticed a mistake. Please update the function this this: function display_book_chapters( $args ){ if( isset( $args['id'] ) ){ $chapters = pods_field( 'book', $args['id'], 'chapter' ); if( ! empty( $chapters ) ){ foreach( $chapters as $i => $chapter ){ echo '<div>'; echo $chapter['name']; $pdf_url = wp_get_attachment_url( $chapter['pdf'] ); if( $pdf_url ){ echo '<a href="' . $pdf_url . '">PDF</a>'; } echo '</div>' ; } } } } using shortcode [display_book_chapters id={post_id}] it works! Do you think you can integrate this to the Bricks UI, like ACF on above video? 🙂 Brilliant. I will look into it when I am less busy. Nice! this can be a good starting point. https://brickslabs.com/adding-any-custom-wp_query-loop-to-bricks-query-loop/ For additional question I think Bricks staff will be glad to help you. OK. Thanks.

Comments

25 shown
dizplay 2023-04-14T17:04:00+00:00

I see that the plugin unfortunately isn’t compatible with bricks query loop (PODS is, the plugin not). as Bricks is becoming the ultimate web design tool, it would be interesting to make this gem of a plugin compatible.

Coding Panda 2023-05-31T08:43:00+00:00

Hi, @dizplay . Thanks for being interested in the plugin. I understand, but Bricks is not free.

dizplay 2023-05-31T08:47:00+00:00

If you ask the Bricks team, they probably will give you a license number valid for your development. They already did with other plugin devs.

Coding Panda 2023-05-31T09:09:00+00:00

I can try. How do you want to use the plugin? Backend or Frontend?

dizplay 2023-05-31T09:24:00+00:00

Both. The issue is that when creating a query loop on backend, the Type won’t show the panda repeater, but only Posts, terms and users. Other plugin (like ACF, Metabox, ACPT) displays also the repeater field in this dropdown. So, Pods is ok, and your plugin it’s even better, it lacks only to be available here.

Coding Panda 2023-06-17T10:24:00+00:00

Hi, @dizplay . OK. Thanks to Bricks, I got a copy. I am new to Bricks. How do I get to that screen? Do you have a pods json package for me to import?

dizplay 2023-06-17T10:47:00+00:00

FANTASTIC NEWS! Bricks guys are really awesome. if you pm me temp admin, I’ll create a tipical scenario. Or you can create the usual Books post type in Pods, with a panda repeater on it, with some images and links in a repeater for a single book. Then have a look here https://academy.bricksbuilder.io/article/query-loop/ Basically on frontend you should create a container with some dynamic data on it (the Flash icon on fields) Like the picture on previous message, Activating the query loop (on the container element that should be repeated) on the post type dropdown you should have also the repeater, if present on the page.

Coding Panda 2023-06-17T15:28:00+00:00

@dizplay Sorry, I don’t to want publish an admin login details. I need more instructions. Do I do these: Create an advance content type for the repeater field (what is the name of the advance content type?) Create a table based Book post type Create a panda repeater field to use the advance content type Which page do I need to edit?

dizplay 2023-06-17T16:59:00+00:00

Install Pods and Panda. Enable “Advanced content type” and ‘Tablke storage’ as per yours tutorials. This is a JSON structure for a custom post type called Books https://pastebin.com/gthr7y7s import it on Pods. in WP admin open Bricks > template, create a new template for SINGLE page, click “edit” it with bricks, copy the pastebin code from https://pastebin.com/grhu5xqh and paste it on the paste icon on the top of the structure panel (right darkgray column on bricks editor interface). With template open, click the cog on the left top and assign the template to the “Books” post type (see here https://i.imgur.com/G6lgBdP.png ) last: create a Book post: on More fields you will find some singolar content (Singolar image, title, gallery) and after a repeader group, with Name and PDF). Fill the singular content and a couple of Chapters (mine https://i.imgur.com/Jb1flDw.png ) After that you can view the book public page (it uses the book template). So, the issue is that on template, the Post type do not show the repeater group (to count how many repeated groups and multiply the relative div on frontend)

Coding Panda 2023-06-17T17:52:00+00:00

Thanks for the detailed instructions. Can it be a shortcode in functions.php, and then add the shortcode to the template?

dizplay 2023-06-17T20:15:00+00:00

During editing the template (bricks interface) you find the Shortcode element on the left colum. Click it and position it where you like on the page. When is selected you see its properties, where you can write the classic Shortcode with square brackets. It’s also possible to use the echo php command: https://academy.bricksbuilder.io/article/dynamic-data/

Coding Panda 2023-06-17T20:35:00+00:00

@dizplay I tried to pass the post id into the shortcode, but {post_id} always returns 1. Do you know how to get the current page ID?

dizplay 2023-06-17T20:53:00+00:00

{post_id} is correct. Be sure to be previewing the real post, and not the template.

Coding Panda 2023-06-18T12:42:00+00:00

I couldn’t get the correct post_id to pass into the shortcode. You know Bricks, would you give it a go? Here is the shortcode: function display_book_chapters( $id ){ $chapters = pods_field( 'book', $id, 'chapter' ); foreach( $chapters as $i => $chapter ){ echo '<div>'; echo $chapter['name']; $pdf_url = wp_get_attachment_url( $chapter['pdf'] ); if( $pdf_url ){ echo '<a href="' . $pdf_url . '">PDF</a>'; } echo '</div>' ; } } add_shortcode( 'display_book_chapters', 'display_book_chapters' ); Use it in the template: [display_book_chapters id={post_id}] This reply was modified 2 years, 11 months ago by Coding Panda .

Coding Panda 2023-06-18T12:42:00+00:00

Use it in the template: [display_book_chapters id={post_id}]

dizplay 2023-06-19T10:49:00+00:00

Using the shortcode i get a warning (but no output): Warning : foreach() argument must be of type array|object, null given in C:\Users\Dee Ego\Local Sites\bricksbuilder\app\public\wp-content\themes\bricks-c\functions.php on line 172 I tries also with a code block (it’s an element like the Shortcode on bricks editor) <?php echo do_shortcode( '[display_book_chapters id="'.$post_id.'"]' ); ?> and in this case i get 2 warnings: Warning : Undefined variable $post_id in C:\Users\Dee Ego\Local Sites\bricksbuilder\app\public\wp-content\themes\bricks\includes\elements\code.php(160) : eval()’d code on line 2 Warning : foreach() argument must be of type array|object, null given in C:\Users\Dee Ego\Local Sites\bricksbuilder\app\public\wp-content\themes\bricks-c\functions.php on line 172 In any case, these solutions would not be ideal, as they do not take advantage of bricks’ internal query system, that is, in making the Repeater appear as a post type in the indicated dropdown.

Coding Panda 2023-06-19T11:12:00+00:00

You can update the function to check if the chapters are available. function display_book_chapters( $id ){ $chapters = pods_field( 'book', $id, 'chapter' ); if( ! empty( $chapters ) ){ foreach( $chapters as $i => $chapter ){ echo '<div>'; echo $chapter['name']; $pdf_url = wp_get_attachment_url( $chapter['pdf'] ); if( $pdf_url ){ echo '<a href="' . $pdf_url . '">PDF</a>'; } echo '</div>' ; } } } I think the problem is that {post_id} doesn’t pass in the correct post id into the shortcode. You can test it by echoing {post_id} without the shortcode, and contact Bricks if necessary. I don’t think $post_id can be used before declaring it. You could try {post_id}. the Repeater is not a post type. It is a field of a Pod which can be a post type.

dizplay 2023-06-19T12:05:00+00:00

Updated functions: warning disappears, but no output. in my case echoing {post_id} results in 336, which is the right one. I also test php code above and also shortcode with hardcoded 336: no warning in this case, but neither the repeated Name/PDF. I know that is not a post type, but the repeater (if present in page) should appears in dropwown: check the ACF version at 14:05 https://www.youtube.com/watch?t=845&v=72zSZ6AOU6Y

Coding Panda 2023-06-19T12:31:00+00:00

Is 336 an ID of a book page?

dizplay 2023-06-19T12:31:00+00:00

in my case, yes

Coding Panda 2023-06-19T12:42:00+00:00

I noticed a mistake. Please update the function this this: function display_book_chapters( $args ){ if( isset( $args['id'] ) ){ $chapters = pods_field( 'book', $args['id'], 'chapter' ); if( ! empty( $chapters ) ){ foreach( $chapters as $i => $chapter ){ echo '<div>'; echo $chapter['name']; $pdf_url = wp_get_attachment_url( $chapter['pdf'] ); if( $pdf_url ){ echo '<a href="' . $pdf_url . '">PDF</a>'; } echo '</div>' ; } } } }

dizplay 2023-06-19T12:52:00+00:00

using shortcode [display_book_chapters id={post_id}] it works! Do you think you can integrate this to the Bricks UI, like ACF on above video?

Coding Panda 2023-06-19T12:55:00+00:00

🙂 Brilliant. I will look into it when I am less busy.

dizplay 2023-06-19T13:01:00+00:00

Nice! this can be a good starting point. https://brickslabs.com/adding-any-custom-wp_query-loop-to-bricks-query-loop/ For additional question I think Bricks staff will be glad to help you.

Coding Panda 2023-06-19T13:05:00+00:00

OK. Thanks.