I’m new to php coding and I need to fix a bug in my friend’s website. Here is the page with the bug http://www.corectura.ro/category/in-presa/ (it’s in Romanian, but it doesn’t matter). “Citeste mai multe…” is the “Read more…” link and it doesn’t work. It just opens the same page (this one: http://www.corectura.ro/category/in-presa/) in a new tab, instead of opening the link/post in order to read more just as the “read more…” button says. The site is on WordPress platform and has a custom theme.
I’ve looked into the editor in all the php files for the section where the “read more” is mentioned. I only found it in archive.php and styles.css.
In the styles sheet the only code i found is this one (regarding to the read more link)
.r_more{ display:block; text-align:right; }
And in the archive.php the code below:
<li>
<div class="post_thumbnail"><?php the_post_thumbnail('thumbnail'); ?></div>
<div class="post_content"><h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="date_post"><?php echo ucfirst(get_the_date('F Y')); ?></div>
<?php the_excerpt();
echo '<a href="'.the_permalink().'" class="r_more" target="_blank">CiteÅte mai multe...</a>';
?>
</div>
</li>
Is there something wrong with this code? Is the syntax correct? Why does it open the same page in a new tab instead of opening the page with the content that’s needed to be shown after clicking “Citeste mai multe…” (“Read more…”)?
Please help. Thank you.
You are using
echo
, so you need to changethe_permalink()
toget_permalink()
(whichreturn
s the permalink):Try this instead: