Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Wrap a span in div automatically in the TinyMCE editor in Wordpress

I am kind of lost. I try to provide a way that the editor in the backend is able to enter content in the wysiwyg field (tinyMCE) in Wordpress. Expected content is text (automatically wrapped in p tags), images (spans - it is picturefill markup) and embedded videos (iframe tags).

Video iframes i was able to wrap in a div with:

function sk_embed_oembed_html($html, $url, $attr, $post_id) {
  return '<div class="ir-video">' . $html . '</div>';
}
add_filter('embed_oembed_html', 'sk_embed_oembed_html', 99, 4);

but i have no idea yet how to wrap a span properly in a similar way. Does anyone know? Best regards Ralf

1 Answer

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Hey Ralf, can you clarify what you mean by wrap in a span isn't working? Doesn't it work if you follow the same formula above?