• Resolved 65142

    (@ulframinos)


    Hi, hope u had a nice day.

    I’m doing localhost to test wordpress :v

    I wanted to know if there is any chance to be able to show the content of the link in the comment from twitch and facebook, what i mean by that is, if someone puts a link to a pic, the pic appears in the comment, same with a youtube video, if the link is put the video appears, but if i put the link of a stream of twitch o video from facebook, just the link appears.

    I tryed a few plugins, but it didn’t work with any of them.

    Thanks for reading even if u can’t help.

    Take care!

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    The conversion of URLs to embedded content is done through oEmbed client and server. If the URL target does not serve oEmbed content, the scheme will fail. If placing URLs in regular post content on their own line (in code or text view) results in embedded content, then an oEmbed server is active at the source. WP does a little bit of coding magic with post content to make this happen, but not so with comments.

    To do so with comments, instantiate the WP_Embed class and run comment content through the class’ autoembed() method. URLs still must occur on their own lines for this to work. It’s unlikely for commenters to know this.

    Thread Starter 65142

    (@ulframinos)

    Hello bcworkz thanks for giving me a solution, but could you tell me how to implement it? Unfortunately I am newbie and I don’t have the knowledge to apply it with what you mentioned, I should use “public function autoembed ($ content) {” and put the comments code inside his {} ?

    Sorry for the ignorance, and thank you very much for your patience, it is much appreciated, thank you again for helping me during what is surely a day of rest for you.

    Moderator bcworkz

    (@bcworkz)

    That’s a good guess despite your lack of knowledge, but in truth you’re way off. I’m not in a position to provide a fully coded solution for you, sorry. If you know someone who can code PHP, even if not fluent with WP, they might be able to put something together. If not, you could hire knowledgeable coders through resources like https://jobs.wordpress.net/ or https://jetpack.pro/

    This will not make sense to you, but it might help someone:
    Use “the_comments” filter to access comments about to be output. For each comment in the array passed to the callback, extract the comment content and pass it through WP_Embed::autoembed() and set the content in the returned comments array with the returned value.

    This is an untested concept, but it’s essentially what WP does with post content.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Twitch and Facebook in comments’ is closed to new replies.