Celebrating 7 Years! Get up to $30 off GeneratePress Premium!

[Resolved] Use 'Disable Elements' value in my PHP

Home Forums Support [Resolved] Use 'Disable Elements' value in my PHP

Home Forums Support Use 'Disable Elements' value in my PHP

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #517620
    Andy

    Hi Tom/all,

    I’m using a hook in ‘generate_after_header’ to display (or not) featured images on my page – it all works well. I’m using it as a global rule for certain custom post types, but there are now some where I want hide the featured image, but ONLY if the pages default option ‘Disable Elements: Featured Image / Page Header’ has been checked.

    Can you please tell me what identifier I can use in my PHP to add this as an argument (eg. is there a has_post_thumbnail_disabled() ? ).

    Cheers.

    Andy

    GeneratePress 2.0.2
    GP Premium 1.5.6
    #517991
    Tom
    Lead Developer
    Lead Developer

    Hi Andy,

    Do this in your hook:

    <?php if ( ! get_post_meta( get_the_ID(), '_generate-disable-post-image', true ) ) : ?>
        Your featured image stuff
    <?php endif; ?>

    Let me know πŸ™‚

    #518009
    Andy

    Yes – that’s just what I was after. Awesome as always, Tom πŸ™‚ Cheers!

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