So I’m trying to enqueue scripts used for some post formats like video and audio and I could find a way to check what post formats are going to be shown on the page.
I tried print_r on some global variables but they doesn’t seems to have post_format in the post details, I tried $posts and $wp_query and also tried print_r on $GLOBALS.
I also tried adding an action for video and audio post formats but the action runs too late for queuing scripts.
have anyone done something like this before ?
and thanks in advance.
Inside the Loop, try something like the following:
Now that WordPress can handle inline script-enqueueing, this should work fine.
If you can find the post id within functions.php, you should be able to use
if (
has_post_format
($ID) )
no?