Hi, how can one access the video url of the featured video of a video post? I mean via PHP. I would like to write the PHP snippet to be able to create video popup button inside single post template. Just point me to the right direction, I will manage PHP script myself.
Hello !
This should be the correct path: https://www.screencast.com/t/8Xkkonai6b
Please note that some file smay not be available and also some codes may be spreaded and linked in more files than one.
Thank you !
Thanks Vlad!
It works inside the post. I have already achieved it also using td_post_video meta keys.
The issue is that I would like to make the snippet work in a single page template. But, it does not work there… Any ideas to point me?
One example of the use could be to update an icon block or a button block via theme API in a way we clould use the featured video URL in the video popup field…
Thanks!
-
This reply was modified 6 years by
manasek.
Vlad, I have managed the first half of the task. I am able to retrieve the featured video URL using following snippet inside any single post template:
global $wp_query, $post, $tdb_state_single;
$post_id = $tdb_state_single->get_wp_query()->post->ID;
$post_title = $tdb_state_single->get_wp_query()->post->post_title;
$td_post_video = get_post_meta($post_id, 'td_post_video', true);
I have found the answer inside tdb_view_single.php
Hi,
for those interested, below is the code I have gone with. In my case, I created a shortcode and pasted it in the content area of the text block placed in an inner row inside the single featured background image block (by the way, why the pure HTML block doesn’t accept shortcodes?)
<?php global $wp_query, $post, $tdb_state_single;
$post_id = $tdb_state_single->get_wp_query()->post->ID;
$post_title = $tdb_state_single->get_wp_query()->post->post_title;
$td_post_video = get_post_meta($post_id, 'td_post_video', true); ?>
<div class="my_wrap_icon_style">
" data-mfp-src="<?php echo $td_post_video['td_video'];?>">
<span><i class="tds-icon tdc-font-tdmp tdc-font-tdmp-play-round1 my_icon_style"></i></span>
</div>