Skip to content

Instantly share code, notes, and snippets.

@BFTrick
Last active October 10, 2015 05:07
Show Gist options
  • Save BFTrick/3637935 to your computer and use it in GitHub Desktop.
Save BFTrick/3637935 to your computer and use it in GitHub Desktop.
This script looks for a featured image on the current page, if it can't find a featured image it will continue to look backwards through the family tree until it can find one. Then it will print it.
@rachelbaker
Copy link

Don't forget to check that $post has been set.
global $post
if ( isset($post) ) {
// your code here

}

@BFTrick
Copy link
Author

BFTrick commented Apr 17, 2013

@rachelbaker Thanks for the tip! I don't know why I didn't see this notification earlier but I appreciate it. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment