• Hi there

    @jeresmash

    I am having trouble with the plugin and a combination of ACF and Custom Post Type.

    I seem to be able to get 1 section to hide or not hide, however, I don’t seem to be able to get multiple sections to hide.

    We have 5 sections in total, some of which don’t have any content, in most cases just 2 or 3, and a few that have all 5.

    The plugin’s behavior seems to work fine when we have 1 criteria running, but if we have 2 or more running, then none of the content appears for any of the sections.

    Any help or advise you can give much appreciated. We have tried using

    function_exists(‘get_field’) && get_field(‘event_end_date’) && get_field(‘event_end_date’) !== ” from a previous post.

    Many thanks

    Steve

Viewing 6 replies - 1 through 6 (of 6 total)
  • 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 4 years, 11 months ago by jeresmash.
    Plugin Author Jonathan Horowitz

    (@jhorowitz)

    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!

    Thread Starter stevegayler

    (@stevegayler)

    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

    Thread Starter stevegayler

    (@stevegayler)

    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.

    Plugin Author Jonathan Horowitz

    (@jhorowitz)

    function_exists('get_field') && get_field('gigmemorabiliagallery') && get_field('gigmemorabiliagallery') !== ''

    It needs to be get_field in function_exists.

    Thread Starter stevegayler

    (@stevegayler)

    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

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Hiding several sections based on ACF being blank’ is closed to new replies.