Outputing ACF fields by using PRO

Hi,

I am playing with the Looper and Templates for Dynamic Data output and have got a few questions:

  1. I have ACF fields created for the Custom Post Type. Some of them are required and some are optional. I would like to wonder how to hide an element outputting info from an ACF filed if it is blank? I can not figure out the Condition statement which will do that (or maybe this option doesn’t exist for ACF fields for now).

  2. I can not output the name of a taxonomy category created for Custom Post Type by using CPT UI. It outputs its ID or some strange code but not the name of the category selected for that taxonomy. What am I doing wrong?


Hello @imdyakov,

Thanks for writing in!

1.) We do not have a condition that determines whether it is null or empty. You may create a condition that checks if it is uncategorized or not instead.

2.) Displaying the field should be using {{dc:acf:field field="name"}}.

To better assist you with your issue, kindly provide us access to your site so that we can check your settings. Please create a secure note with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role

To know how to create a secure note, please check this out: How The Forum Works

Best Regards.

  1. Please consider adding that because it is essential and going to be used widely. If any element is empty (doesn’t meter if its an ACF field or any other it has to have an option to be hidden).
  2. Just to make clear. I want to output taxonomy title for current Custom Post Type post. {{dc:term:title}} outputting nothing. If I add ACF field which allows selecting taxonomy (which is basically the same thing as to do it in regular WP way), then it outputs an ID of that taxonomy or some code depending on the settings of the ACF filed. As you can see at the screenshot in the subheading to the first headline in the right column I tried to output it in standard way but it is empty.

hello,

i think you could make a workaorund for this inside of acf with the field conditions.
make a field for the backend:

field Name: (just for backend)
then a field for the frontend with Name_Front: (here there should be a default value eg: Name)
then a field with Your_Name: (here the client can type the name in the backend eg: Matt)

now make a condition in the field Name_Front: field name_front only visible if field Your_Name has value

now you have to output: Name_Front and Your_Name in the Frontend trough dc.
If the client does not enter his name in the backend, also the field Name_Front should not be visible.

this should work. not the legenat way but a workaround :slight_smile:
cheers

Yeah, that sounds rather complicated. But thanks anyway. Maybe I will try to read it again later.
In Elementor you can do both things I mention here above very easily and you do not need to write this codes every time to output ACF fields data. Just select them from the list, that is much more convenient quicker and excludes typos. Hope that it will be improved someday also in PRO. Looper by itself is already a big step forward for making PRO more usable for dynamic content. But after giving another try the theme after a few years of not using I spent a lot of time trying to figure out the scenarios mentioned. Unfortunately, I still tend to switch back to Astra + Elementor or Brizy for the projects I need to make now. Despite of that I really like how Themeco approaches things. But for the moment if you compare time spent for implementing something more specific like this in PRO and you are stuck for days or weeks with a resolution the odds are not on PRO’s side still. Looking forward for coming updates which I hope will change the situation.

Hey @imdyakov,

Thank you for your feedback. I’ll forward this as a feature request so this might be taken into account in a future release.

Thanks @christian.
Hiding elements with no data and output of ACF taxonomies is a must I believe.
Selection of ACF fields instead of manual input of codes is definitely can make life easier and save time but current implementation is also acceptable of course.

Hi @imdyakov,

I hope you’re doing well today. This thread was brought to my attention via the issue tracker and I wanted to chime in with some additional clarification:

I can not output the name of a taxonomy category created for Custom Post Type by using CPT UI. It outputs its ID or some strange code but not the name of the category selected for that taxonomy. What am I doing wrong?

Try enabling a Looper with the type “Current Post Terms”. This will allow you to iterate over all the terms (in a selected taxonomy) associated with the current post. If you add a child element with Looper Consumer enabled, the {{dc:term:title}} should start working.

I have ACF fields created for the Custom Post Type. Some of them are required and some are optional. I would like to wonder how to hide an element outputting info from an ACF filed if it is blank? I can not figure out the Condition statement which will do that (or maybe this option doesn’t exist for ACF fields for now).

This is a planned feature that we have slated for the Pro 4.1 release which is a shorter cycle going live within the next few weeks. We’ve not settled on an exact approach yet, but it will be possible using Element Conditions to take Dynamic Content and check if it is empty, or has the presence of a particular string. Because it will be based on Dynamic Content, it will naturally integrate with ACF.

Regarding this example:

{{dc:term:meta key="sport"}}

Unfortunately, retrieving term meta is only effective if the value is stored as a scalar (string, number, etc.) value. This isn’t always the case. We’re working on a way to do something like this instead:

{{dc:term:acf field="sport"}}

It would be run through the ACF get_field function which ensures the way you configure that field will be accounted for. Most notably it will make sure if you choose an output type of URL, it won’t output the ID instead.

Additionally, (albeit a bit off topic) we’re going to be adding support for Loopers to integrate with ACF Repeater fields.

After this update we received an astonishing amount of feedback on how the Looper and Condition systems could be expanded upon for certain use cases, many of which involve ACF. We’re in the process of implementing much of that feedback in a smaller release cycle as a followup to the Layout Builder release.

Thanks @Alexander!

{{dc:term:title}} started working after changing to the “Current Post Terms”, selecting respective taxonomy and activating Looper Consumer for the same Section.

What you posted about the plans for coming releases of PRO is also very promising. I am looking forward to check these features out as soon as PRO 4.1 available. I guess we will also need more videos / documentation on how to use all theses features properly.

Keep the momentum for brining the Looper to the level of the most flexible and convenient tool ever for dynamic content. :+1:

Thanks, @imdyakov!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.