Archived topic
Use 'Disable Elements' value in my PHP
3 replies · Started by Andy on March 12, 2018
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
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 :)
Yes - that's just what I was after. Awesome as always, Tom :) Cheers!
Glad I could help! :)