[Resolved] Using embed_oembed_html

Home Forums Support [Resolved] Using embed_oembed_html

Home Forums Support Using embed_oembed_html

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1343927
    Derek

    I tried adding the following code to the functions.php file to change the output of an embedded Youtube video but nothing changes. I tried this with a plain WordPress install and changing to the Twenty Twenty theme and it worked with that theme but not GeneratePress.

    add_filter( 'embed_oembed_html', 'append_oembed_html', 99, 4 );
     
    function append_oembed_html( $cache, $url, $attr, $post_id ) {
        if ( false !== strpos( $url, "://youtube.com") || false !== strpos( $url, "://youtu.be" ) ) {
            $cache =  $cache . '<br>video link: '. $url .'';
        }
        return $cache;
    }
    #1343951
    Derek

    I see now that it is rendering but underneath the video and inside a figure and div tag

    #1344029
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    GeneratePress itself shouldn’t alter the content output at all. Any chance you can link us to the page so we can take a closer look?

    Let me know 🙂

    #1344870
    Derek

    I see that it’s not a generatepress problem as the same code is generated for both generatepress and twenty twenty themes on a clean WordPress install. There must be another plugin that is causing the change to not appear at all in one of my projects. Thanks

    #1345888
    Tom
    Lead Developer
    Lead Developer

    No problem!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.