Friday, June 17, 2022
HomeWordPress Developmentphp - Wordpress get_media_embedded - WordPress Improvement Stack Alternate

php – WordPress get_media_embedded – WordPress Improvement Stack Alternate


 take a look at textual content

<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 is my code

Visual Representation

Lastly exhibits me the video, however I get this on the front-end:

Array ( [0] => )

Why?

Altering print_r($media) to print($media) removes the video.

Information concerning the file

That is the whole file. It is referred to as content-video.php. WordPress routinely hooked up this file to the put up format. When it loops by the posts it instantly checks the put up format and whether it is put up format then it fetches the file accordingly. On this case that is content-video.php.

Additional about me

I apologize if it is a no brainer. Have been making an attempt to learn the way all of this works for some time now, together with loads of hours right now, in all probability going to be engaged on figuring this out till the night time. Figured possibly I may get somebody to inform me what’s up in simpler phrases, there’s already quite a bit that I’m making an attempt to get a grasp on. Thanks. I’m new to WordPress theme growth, new to PHP and new to JS.

The Purpose

Pull the embed video from the put up content material to show on a unique web page.

Finest Try

What I’ve to date, which I’m nonetheless making an attempt to wrap my head round.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments