• 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 Author Matthias Kittsteiner

    (@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 Author Matthias Kittsteiner

    (@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 [email protected].

    Plugin Author Matthias Kittsteiner

    (@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)
  • The topic ‘Custom Content Embed with individual text?’ is closed to new replies.