• ergoticpsilocineyeoftheabsolute

    (@ergoticpsilocineyeoftheabsolute)


    Hello everyone. Is there way to detect if there is content or not in template file when content is added via customizer?

    Like this:
    if not empty
    echo get_theme_mod(‘content’)
    if empty ”

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    It depends on what content you’re looking for. Customizer data is either saved as an option or a theme mod. Template code could get what ever data is saved and do one thing or another based on what is returned.

    Thread Starter ergoticpsilocineyeoftheabsolute

    (@ergoticpsilocineyeoftheabsolute)

    I have simple section with few controls and settings in customizer where user can add images and text. In template file I use get_theme_mod. I’d like to hide the containing div element from template when there’s no images or text added to this customizer section.

    Thread Starter ergoticpsilocineyeoftheabsolute

    (@ergoticpsilocineyeoftheabsolute)

    Found the answer:
    if ( get_theme_mod( ‘content’ ) ) :

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Detect if content is added in customizer’ is closed to new replies.