• eknip

    (@eknip)


    Hi everyone,

    Is there any function in WordPress that I can use to oEmbed content? I’m doing a custom SQL query to select the latest video that has been posted and would like to use oEmbed to embed it inside my theme.

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi

    (@esmi)

    http://codex.wordpress.org/Embeds

    Aren’t search boxes wonderful!

    Thread Starter eknip

    (@eknip)

    Sorry that’s not my question/problem. I understand that it’s frustrating to see questions that seem quite simple to find a solution for.

    My question however is if there is a WordPress function, [em]something like get_oembed_code()[/em], that I can use inside my theme that will return the correct embed code.

    As I mentioned before, I’m doing a custom SQL query to select the latest blogposting that contains a youtube url inside the ‘post_content’ column. After that I filter the actual URL from $result->post_content.

    So basically I want to create an oembed code from the URL, possibly outside the loop. Why? Because I think it’s nice to make proper themes that still use as much of WordPress’ features as possible.

    Thanks!

    esmi

    (@esmi)

    I want to create an oembed code from the URL

    But if this is for use on your site (or A.N.Other WP site), the bare url (with leading and trailing blank lines) is all that’s needed to embed the video. Or you could wrap the URL in the [embed] shortcode.

    joost538

    (@joost538)

    <?php echo apply_filters(‘the_content’, $string_containing_url); ?>

    But it doesn’t work when you are outside a post or page, does it? I am trying to achieve this on my author.php template and it doesn’t work…

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Use oEmbed inside theme’ is closed to new replies.