Replies: 0
Hi!
I’m having a problem when I try to embed links from soundcloud and Spotify, on the editor when I paste the link, the editor automatically embed it. But when I save and open the post page, just the raw link appears. I’m testing the site on localhost, I don’t know if this can change something, and this is my single.php code, where I’m editing:
<?php
get_header();
?>
<div id="primary" class="content-area single">
<main id="main" class="site-main">
<div class="back desktop" onclick="window.history.back()"><img src="<?php echo get_template_directory_uri() . '/images/icones/arrow_left_black.svg' ?>" alt="◄"> Voltar</div>
<?php
if( have_posts() ) :
?>
<img class="thumbnail" src="<?php echo get_the_post_thumbnail_url() ?>">
<h3>
<?php echo get_post()->post_title; ?>
</h3>
<div class="hr" style="margin: 0 0 24px 0;"></div>
<?php
endif
?>
<div class="general">
<?php
if ( have_posts() ) : the_post();?>
<div class="news-list">
<div class="meta">
<?php
$newspaper_icon = get_template_directory_uri() . '/images/icones/newspaper.png';
$time_icon = get_template_directory_uri() . '/images/icones/time_black.svg';
$source_link = get_field('fonte_link', get_the_ID());
$source_name = get_field('fonte_nome', get_the_ID());
if($source_name) : ?>
<span class="source"><img src="<?php echo $newspaper_icon; ?>" alt="@">Fonte: <?php echo $source_name; ?></span>
<?php
endif ?>
<span class="date"><img src="<?php echo $time_icon; ?>" alt="Data:" style="opacity: .5;"><?php the_date(); ?></span>
</div>
<div class="content">
<?php
echo get_post()->post_content;
//get_template_part( 'template-parts/content', get_post_type() );
?>
</div>
<?php
if($source_link) : ?>
<a href="<?php echo $source_link; ?>" title="Ver matéria original" class="link">Clique aqui para ver a matéria original.</a>
<?php
endif ?>
<div class="back big" onclick="window.history.back()">
<img src="<?php echo get_template_directory_uri() . '/images/icones/arrow_left_black.svg' ?>" alt="◄"> Voltar
</div>
<br>
<?php
$id = get_the_ID();
$post_tags = get_the_terms($id, 'tag');
$similar = new WP_Query(array(
'post_type' => 'news',
'posts_per_page' => 3,
'tag__in' => $post_tags,
'post__not_in' => array($id)
));
echo '<p>' . json_encode($similar) '</p>';
if($similar->have_posts()) :
?>
<div class="more">
<span class="title"><img src="<?php echo get_template_directory_uri() . '/images/icones/hexagons.png' ?>"> Veja mais notícias sobre estes temas:</span>
<div class="tags">
<?php
if($post_tags) {
foreach($post_tags as $tag) {
echo '<a class="tag" href="">' . $tag->name . '</a>';
}
}
?>
</div>
<div class="similar">
<?php
while($similar->have_posts()) {
$similar->the_post();
?>
<div class="card" style="background-image: url('<?php echo get_the_post_thumbnail_url(); ?>')">
<div class="content">
<div class="tags">
<a class="tag" href="/busca?tag=geral"><?php echo get_the_tags()[0]->name; ?></a>
</div>
<h3 class="title"><a href="<?php the_permalink(); ?>"><?php the_title() ?></a></h3>
<div class="date">
<img src="<?php echo get_template_directory_uri() . '/images/icones/time_white.svg' ?>" class="icon"><?php the_date() ?>
</div>
</div>
</div>
<?php
}
?>
</div>
</div>
<?php
endif ?>
</div>
<?php
endif ?>
<div class="side-panel">
<form class="terms search">
<h3>Busca</h3>
<label for="busca" class="field">
<input type="text" name="busca" id="busca" placeholder="Busca por palavra chave" value="<?php echo isset($_GET['busca']) ? $_GET['busca'] : '' ?>" required>
<button type="submit" class="submit"><img src="<?php echo get_template_directory_uri() . '/images/icones/search_thin_purple.svg' ?>" class="icon"></button>
</label>
</form>
<?php
if ( is_active_sidebar( 'sidebar-1' ) ) {
dynamic_sidebar('sidebar-1');
}
?>
</div>
</div>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer(); ?>
There is something I need to put on my header, ou somewhere else so the link could be embedded?