test text
<div class="video">
<?php
$media = get_media_embedded_in_content( apply_filters( 'the_content', get_the_content() ));
print_r($media);
;?>
</div>
<div class="uitgelichttitel">
<?php the_title();?>
</div>
that's my code
Finally shows me the video, but I am getting this on the front-end:
Array ( [0] => )
Why?
Changing print_r($media)
to print($media)
removes the video.
Info about the file
This is the entire file. It's called content-video.php. WordPress automatically attached this file to the post format. When it loops through the posts it immediately checks the post format and if it is post format then it fetches the file accordingly. In this case that's content-video.php.
Extra about me
I apologize if this is a no brainer. Have been trying to learn how all of this works for a while now, including plenty of hours today, probably going to be working on figuring this out until the night. Figured maybe I could get someone to tell me what's up in easier terms, there's already a lot that I am trying to get a grasp on. Thank you. I am new to Wordpress theme development, new to PHP and new to JS.
The Goal
Pull the embed video from the post content to display on a different page.
Best Attempt
What I have thus far, which I am still trying to wrap my head around.
The Fix
Provided by TheDeadMedic:
Change "print_r" to "print current"
Loads of gratitude for the help! I finished my registration so that I can contribute to StackExchange in the future.