Created
September 13, 2017 08:50
-
-
Save aliaghdam/d35c57afaa4be1eb6bea48643fe1817f to your computer and use it in GitHub Desktop.
Show Newspaper (by TagDiv) post videos in Publisher (by BetterStudio)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( "get_post_metadata", 'bs_replace_td_video_code', 10, 4 ); | |
function bs_replace_td_video_code( $null, $object_id, $meta_key, $single ) { | |
if ( $meta_key == '_featured_embed_code' ) { | |
remove_filter( "get_post_metadata", 'bs_replace_td_video_code', 10 ); | |
$td = get_post_meta( $object_id, 'td_post_video', TRUE ); | |
add_filter( "get_post_metadata", 'bs_replace_td_video_code', 10, 4 ); | |
if ( ! empty( $td ) && is_array( $td ) && isset( $td['td_video'] ) ) { | |
return $td['td_video']; | |
} | |
} | |
return $null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment