Skip Navigation

[Resolved] Unable to Display Types Field within Visual Composer Grid Builder

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.

This thread is resolved. Here is a description of the problem and solution.

Problem:
Add Visual Composer and create a GRID with some Types ShortCodes (fields).
See that on the front end those Fields are not shown when inserted to GRID and then into Visual Composer elements in a page/post.

The Post Object is lost, you can call the post fields only by passing a explicit numeric ID

Solution:
This is not a BUG.

Toolset allows you to call Custom Fields by this criteria:

- The current post being displayed either directly or in a View loop
- The parent of the current post (WordPress parent)
- The parent of this post, set by Types (parent/child relationship)
- A specific post ID

VC creates it’s own loop in GRIDs.

This is neither a View Loop, a Current Post, or similar.
It’s the result of a 3rd party Query, and that cannot be considered yet in our ShortCodes.

A feature request is filed to make it possible, please add your voices in comments here if you wish to upvote it.

0% of people find this useful.

This support ticket is created 6 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 13 replies, has 3 voices.

Last updated by andrewB-9 6 years, 8 months ago.

Assisted by: Beda.

Author
Posts
#563774
Grid View 5.JPG
Grid View 4.JPG
Grid View 3.JPG
Grid View 2.JPG
Grid View 1.JPG

Hi,

I am trying to display a particular Types Field within the Visual Composer Grid Builder.

The meta key for the field is: wpcf-video-or-virtual-tour.

When I put WP Types shortcode in, to display a post field, it does not appear in the front end. See example:
Grid View 1: The positioning of all elements
Grid View 3: Post Field Details
Grid View 4: The current (incorrect) front end output of the grid.
Grid View 5: What I want the grid to output.

You'll notice one example of the field showing, at that has been generated by a particular setting within the grid builder called 'Custom Field Settings' (See Grid View 2 Image). Unfortunately this isn't particularly useful, since i need to build the field into some code to display it correctly.

Link to a page where the issue can be seen: hidden link

Are you able to help? Do i need to authorise something within WP Toolset to enable WP Types Shortcode to work in the grid builder?

Thanks so much,
Kate

#563817

I see you successfully output the fields content with our shortcodes.

And that is the correct way to display Fields of Types:
to use the Toolset ShortCodes.

==> https://toolset.com/documentation/user-guides/benefits-of-templates-for-custom-types-vc/ > Adding Fields to the Visual Composer Design

Some Fields might not be read well by Visual Composer when you pass the slug to their parser because they are complex - not like single Line fields, which could work in this case.

#563915

Hi Beda,

Thanks so much for your assistance.

Yes I can add types fields to my website.

Are you telling me I cannot add the Types field the way I want to here? Or it is possible, I just need to change the way I'm doing something....can you please clarify?

Ta,
Kate

#564532

Hi Beda,
Any chance you could help me out with this answer?
Really keen to sort this out.
How should I be using Types shortcode, to display a Custom Field, in the Visual Composer Grid builder. Because the usual way (ie., [types field='field-name' output='raw'][/types])is not working.
Thanks!
Kate

#564689

How should I be using Types shortcode, to display a Custom Field, in the Visual Composer Grid builder.

With the Types ShortCodes provided, as the DOC elaborates.

Some Fields require a complex render method and will eventually break when output by other render code.

I could imagine that a simple line field works the way you use it, but not a complex field like a video or even select, checkboxes, and so on.

#564945
FrontEnd.JPG
Grid Builder.JPG

So that's a no? I'm sorry - I'm still not sure what your response is.

I'm not able to get even simple Types Shortcode to working? See new screenshots.

Is WP Types incompatible with the Visual Composer Grid Builder? Or am I using the incorrect syntax?

Thanks.

#565048

You are able to display Types ShortCodes.

It works fine, you just insert them like we show in the DOC:
https://toolset.com/documentation/user-guides/benefits-of-templates-for-custom-types-vc/ > Adding Fields to the Visual Composer Design

This DOC; as the heading says, shows how to add Custom Fields to a Visual Composer structure.

It shows that you insert a field with a ShortCode of types.
And that is what is supported, and what works as well.

The method you use, by adding the slug of the field to a Visual Composer setting, is not something we document (correct me if wrong) and it is not suggested because Types fields can and should be rendered by their ShortCodes.

Specially for complex fields it is important, as other wise the display is broken.

#565437

Hi Beda,

OK. I've read the article for a second time, and as far as I can tell, I'm using Types correctly (I've used types for a few years now - and not come across this problem before).

I've tried using other fields within the layout in question ('simpler' fields - since you indicated the one I was trying to use may have been too complex). And I'm still unable to get the types fields to work.

Can you or one of your colleagues please watch the screenshot video i have taken for you, showing you that the types shortcodes I have used are in fact NOT working.

Video screenshot: hidden link
Regarding types on this page: hidden link

Help?

Thanks,
Kate

#565486

You are using the Fields correctly, yes.

I understood from your description here that you enter them in the field key name:
https://toolset.com/forums/topic/unable-to-display-types-field-within-visual-composer-grid-builder/#post-563774

And that is wrong.

So, now I see you use it right, and it's not working, but it is supposed to.

And on the Duplicator you provided me, the Fields work.
See for example the post 556-princess-st-kew/.
Those Address Fields are from Types. (left hand corner).

As long the Types Field has a value it will display.

Now, on sold-gallery/, this is a differnt issue.

Here you use a Visual Composer Grid to display the Posts.
I do not see where you add/design a Content Template with Visual Composer here.
This page has no Content Template, and the Images are created by Visual Composer.

I would suggest to use a View there, and design the View Content Template with Visual Composer.

Can you pin point me to the Content Template that is supposed to render the Images thru the Visual Composer Grid, and how you bind them?

#565535

Thanks so much Beda. I'm building this page using the Grid Builder. You can find this here.

Go to the backend. In side menu go.... Visual Composer -> Grid Builder -> Featured Properties

I would really prefer to use this method if possible - if I were to build views, I would need to build multiple views replicated to display the same view for different category outputs. I also want to keep the layout and style from the grid builder. So if we can keep it there it would be great.

Thanks!

#565830

I see what happens.

The Types ShortCode does not receive the ID of the Post where the Custom Fields are saved to (current post).
Probably the Query that the Grid Builder builds does interfere here.

You can currently solve the issue by doing the following:
- Pass a manually hard coded Post ID to the ShortCodes:

[types field='street-address' id='38'][/types]

Where "38" is the ID of the Post where I want the address to be displayed.

This is of course not a desirable approach. But it seems the grid builder "resets" the loop here, and we loose the Post ID of the Post displayed.

I will escalate this, eventually, we will need to work together with the 3rd party developers as well.

The solution could be a View, where you display posts depending on the current page.
In Views, this ShortCodes will get the right ID.

#565834

I have analysed this more.

This is a new feature, not a BUG.

Toolset allows you to call Custom Fields by this criteria:
- The current post being displayed either directly or in a View loop
- The parent of the current post (WordPress parent)
- The parent of this post, set by Types (parent/child relationship)
- A specific post ID

Visual Composer creates its own loop in those GRIDs.
This is neither a View Loop, a Current Post, or whatsoever listed above.

It’s the result of a 3rd party Query, and that cannot be considered yet in our ShortCodes.

I create a Feature Request in Views (or Types) to make it possible to call ShortCodes this way.

#566164

Got it. Thanks so much for looking into that Beda. Hope its something Types can build into a future release.

Cheers,
Kate

#605912

Hello, I would love to see this feature request realized. I much prefer Toolset to tools like ACF and Pods, but I am also a big fan of WP Bakery's Grid Builder, and many of my clients request WP Bakery's Grid Builder, but are indifferent to how I handle custom post types and fields. In that scenario, I use ACF because it works well with the Page Builder. I would definitely use Toolset if I could!

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.