S
S
sergey-novik2018-02-14 11:17:13
YouTube
sergey-novik, 2018-02-14 11:17:13

Why doesn't the Embed link in a Wordpress post load?

I am writing a theme for Wordpress. The posts page is ready, but there is a problem with the embed links.
In the visual post editor, embed links are easily converted into the desired form (for example, a link to a Youtube video becomes a player, a link to an Instagram photo becomes a photo, a link to a Twitter post becomes a Twitter post), i.e. all content is embedded in the Wordpress visual editor normally, the record is saved. But when viewing this post on the single.php page (the standard page template for displaying posts), instead of the built-in embed block, I get a simple, even non-clickable, link (plain text).
What could be the problem?
While in other places such links are converted normally. The only problem is with the records.
PS Emdeb for Instagram added in functions.php file.
5a83f05bcbcc4668513267.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sergey-novik, 2018-02-14
@sergey-novik

Well, the answer is starting to emerge...
Here's the code that helped me get the embed links to embed.

<?php
  $url = $_SERVER['REQUEST_URI'];
  $postid = url_to_postid($url);
  $post = get_post($postid); 
  $title = $post->post_title;
  $author = get_the_author_meta("display_name", $post->post_author);
  $date = $post->post_date;
  $content = apply_filters( 'the_content', $post->post_content ); //ранее было просто $content = $post->post_content;
  $com_count = $post->comment_count;
  $com_status = $post->comment_status;
  $thumbnail = get_the_post_thumbnail_url( $postid, 'full');
?>
<div class="text">
  <?php echo $content; ?>
</div>

All this led to the fact that Youtube videos are displayed completely normally, but problems remain with Instargam and Twitter: in the first, the photo does not load, and in the second, the design.
Thoughts and good advice?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question