Hi @stevegayler,
The developer told me to use this function, I’m using it in each module I need to show or not:
function_exists(‘get_field’) && !!get_field(‘pdf_file’)
and
function_exists(‘get_field’) && !!get_field(‘pdf_link’)
Notice I’m using ‘pdf_file’ and ‘pdf_link’ depending on what ACF I need to show.
I’m sorry if I can’t be more helpful, I suggest you ask the developer.
Best,
Jere.
-
This reply was modified 5 years, 1 month ago by
jeresmash.
Hi @stevegayler,
This may be related to other ACF issues posted in this support forum.
What type of field are you trying to query? Is it a repeater, a post object, a simple string value?
Thanks!
Hi Jere and Jonathan, and thanks for your replies.
So essentially we are importing data from an access database for a bands gigography.
We have a CPT setup with around 20 fields of data, all essentially text, and in some cases a shortcode for a FooGallery.
We have 1800 records currently.
So we have a custom divi page we have created Where there are potentially 5 different galleries that could display, for memorabilia, for live photos, for a setlist a programme etc.
We have a Full width header, then under that a text box where we are calling the CPT field eg {$giggallery} {gigprogramme} etc.
So I had been using this in the Header
function_exists(‘gigmemorabiliagallery’) && get_field(‘gigmemorabiliagallery’) && get_field(‘gigmemorabiliagallery’) !== ”
Then in the content area as well
function_exists(‘gigmemorabiliagallery’) && get_field(‘gigmemorabiliagallery’) && get_field(‘gigmemorabiliagallery’) !== ”
In some cases there could be no content to display at all, but most have one or 2 as a minimum.
I should caveat we are using the Elegant Themes EXTRA theme which is based on the DIVI builder so I dont think that is where the problem is.
Really appreciate your time in replying.
Steve
I should add I have also tried this
function_exists(‘gigvideo’) && get_field(‘gigvideo’) && get_field(‘gigvideo’) !== ”
Which is testing to see if a youtube field has data and the result is the field is hidden even if there is content in the gigvideo field.
function_exists('get_field') && get_field('gigmemorabiliagallery') && get_field('gigmemorabiliagallery') !== ''
It needs to be get_field
in function_exists
.
Thanks Jonathan, I just cannot get this to work.
On a couple of example pages below, I have duplicated the whole Memorabilia Section to the bottom of the page for testing, and left the original memorabilia section at the top so we can see if there is content or no content.
Here’s 2 examples of pages, 1 with memorabilia to show, and 1 without
https://eurythmics-ultimate.com/concerts/gig1130-1978-09-10-the-tourists-concert-the-marquee-club-london-uk/
Without
https://eurythmics-ultimate.com/concerts/gig1182-2017-06-15-annie-lennox-concert-polar-music-prize-wintergarden-room-stockholm-sweden/
So the top modules are displaying, the first a blank space as there is no memorabilia, the second is showing the gallery fine. For the duplicated section at the bottom of hte page I have set the visibility as per the code above, and it is hiding the Memorabilia Section on every page. Typical content is either blank, or it is for example [foogallery id=”188921″].
If you can spare a moment to review one more time I would appreciate your advice.
Many thanks
Steve