• Hi,

    Is it possible to develop a custom function which could be added to functions.php, automatically wrapping an embedded object (eg. youtube video) in <div> tags?

    I have this following code which works on a similar premise, however, it adds <span> tags and styling to all <p>:

    add_filter('the_content','hightlight_the_paragraphs');
    function hightlight_the_paragraphs($output) {
    if(!is_page()) :
    $output = str_replace('<p>','<p><span style="background: yellow; padding: 3px;">',$output);
    $output = str_replace('</p>','</span></p>',$output);
    endif;
    return $output;
    }

    Could something similar be developed which could automatically wrap this code with <div> tags:

    <object width="480" height="390"><param name="movie" value="https://www.youtube.com/...example_code...></embed></object>

    resulting in:

    <div><object width="480" height="390"><param name="movie" value="https://www.youtube.com/...example_code...></embed></object></div>

    Any suggestions?

    Thank you very much for any help,
    Ray

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom function for embedded objects, eg. youtube videos’ is closed to new replies.