Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress (Pods) oEmbed Items
    primarykey
    data
    text
    <p>I'm using the fantastic Pods plugin to extend Wordpress's basic content types with a few custom ones. I've build an advanced custom type which means I don't get the automatic oEmbed support built into the native page/post types. I've structured it so my custom content type has a pod page using a PHP page template and I have the oEmbed option enabled for my WYISWYG fields that can embed videos.</p> <p>I found <a href="http://wordpress.org/support/topic/filter-hook-for-built-in-oembed-providers-eg-youtube" rel="nofollow">this post</a> which seems to indicate that a basic <code>apply_filter</code> function should automatically handle any embeds but I can't seem to get it to work. I'm a bit new to filters. The code I tried is below:</p> <pre><code>&lt;?php // Fetch body field content from $pods object $mycontent = $pods-&gt;field('field_body'); $output = apply_filters('oembed_dataparse', $mycontent); echo $output; ?&gt; </code></pre> <p>I tried a variety of different filters such as <code>the_content</code> and others but none seemed to work. I believe it may be a scoping/conflict issue with Pod pages since even writing out entire iFrame embed code into the template won't work but only displays an empty iFrame. The global oembed function does the same, i.e.</p> <pre><code>$videourl = 'http://www.youtube.com/watch?v=dQw4w9WgXcQ'; $htmlcode = wp_oembed_get($videourl); echo $htmlcode; </code></pre> <p>In the context of the page template will output:</p> <pre><code>&lt;iframe width="500" height="375" frameborder="0" allowfullscreen="" src="http://www.youtube.com/embed/dQw4w9WgXcQ?feature=oembed"&gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; &lt;/iframe&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload