Cyber Week Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

[Resolved] Conditional Test For Disabled Elements

Home Forums Support Conditional Test For Disabled Elements

  • This topic has 3 replies, 2 voices, and was last updated 3 years ago by Tom.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #423835
    Antar

    Hello, All –

    Is there a way to test if certain elements have been disabled? I want to create hooks that test if (for example) the featured image is disabled, or the title, etc.

    How should I do this?

    Thanks,

    Antar

    GP Premium 1.5.2
    #424225
    Tom
    Lead Developer
    Lead Developer

    You could do this:

    $disable_top_bar = get_post_meta( get_the_ID(), '_generate-disable-top-bar', true );
    $disable_header = get_post_meta( get_the_ID(), '_generate-disable-header', true );
    $disable_nav = get_post_meta( get_the_ID(), '_generate-disable-nav', true );
    $disable_secondary_nav = get_post_meta( get_the_ID(), '_generate-disable-secondary-nav', true );
    $disable_post_image = get_post_meta( get_the_ID(), '_generate-disable-post-image', true );
    $disable_headline = get_post_meta( get_the_ID(), '_generate-disable-headline', true );
    $disable_footer = get_post_meta( get_the_ID(), '_generate-disable-footer', true );

    Then check like this:

    if ( $disable_top_bar ) {
        // Top bar is disabled
    }
    #424229
    Antar

    Perfect. Just what I was hoping for.

    Thanks, Tom.

    Antar

    #424237
    Tom
    Lead Developer
    Lead Developer
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.