Support » Plugin: Embed Privacy » Custom Content Embed with individual text?

  • Resolved snoffel

    (@snoffel)


    Hi there,
    great Plugin, thanks a lot!

    I wrapped my twitter-timeline in a custom content function, following your example code from the faq – this works fine! But it uses only the plugin default text, not my individualized twitter text used for tweet embeds (which i individualized with your new settings-feature in the backend).

    Is there a way to refer in custom functions to this managed text and image parts for all twitter embeds? Or: is there a possibility to inject individual text in this custom contenet function?

    My function (twitter code is shortened):

    function prefix_twitter_replace_content_with_overlay( $content ) {
        // check for Embed Privacy
        if ( ! class_exists( 'epiphyt\Embed_Privacy\Embed_Privacy' ) ) {
            return $content;
        }
    
        // get Embed Privacy instance
        $embed_privacy = epiphyt\Embed_Privacy\Embed_Privacy::get_instance();
    
        // check if provider is always active; if so, just return the content
        if ( ! $embed_privacy->is_always_active_provider( 'twitter' ) ) {
            // replace the content with the overlay
            $content = $embed_privacy->get_output_template( 'Twitter', 'twitter', $content );
        }
        return $content;
    }
    
    $twitter_content = '<div id="twitterbox"><a class="twitter-timeline" href="https://twitter.com/EXAMPLE" width="282" height="478" lang="DE"  [ ... ] <script>!function   [...]   "twitter-wjs");</script></div>';
    
    echo prefix_twitter_replace_content_with_overlay( $twitter_content );
    

    Schöne Grüße!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor KittMedia

    (@kittmedia)

    Hi!

    Thank you.

    So you’ve been using the Twitter timeline neither in the regular content nor in a widget? Because if you do, it should be sufficient to add a particular regular expression to your added timeline instead of using the custom function.

    Thread Starter snoffel

    (@snoffel)

    Hi @kittmedia,

    yes, I use the Twitter timeline as a code-bit inside a special page-template.

    With your hint, I tried it this way:
    echo apply_filters( 'the_content', "https://twitter.com/EXAMPLE");
    which worked fine in my template, with the embed privacy twitter overlay!

    Now I’m very interested in getting to know this “particular regular expression” for my customized timeline so that I get it running with that as well.

    Thanks a lot!

    Plugin Contributor KittMedia

    (@kittmedia)

    To give you a valid regular expression I need to know the exact link you’ve been chasing through this filter. If you don’t want to post it in public, you can also send it to me via email at matze@epiph.yt.

    Plugin Contributor KittMedia

    (@kittmedia)

    I finally had the time to look deeper into this and I noticed that currently not all elements can be replaced by Embed Privacy. In order to achieve this, I added an issue to our project and updated the current developer version:
    https://github.com/epiphyt/embed-privacy/issues/26

    With this, you can get it working with the following regular expression:
    /<div id="twitterbox">(.*)"twitter-wjs"\);<\/script><\/div>/

    Thread Starter snoffel

    (@snoffel)

    Thanks a lot for the quick response!
    I will give it a try in the next version!

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