When I click “read more” at the bottom of one of my website posts, it just loads the rest of the text in the same page and the same section, thus overflowing elements with text and spoiling my layout. I noticed there is a <!--more-->
tag at the end of every WordPress post when Read More is added from the toolbar. How can I override default behavior of this tag so that a new page is opened when a user clicks “Read More…” for a post?
Update:
Post content is loaded from a php file named tazeha.php using jQuery code.
tazeha.php
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css"/>
<?php
require('wp-config.php');
?>
</head>
<body>
<?php
$cat_id=get_cat_ID('تاز٠Ùا');
$posts = get_posts ("cat=$cat_id&posts_per_page=1");
if ($posts)
{
foreach ($posts as $post):
setup_postdata($post); ?>
<h2><?php the_title(); ?></h2>
<?php the_content();?>
<?php endforeach;
}
?>
</body>
</html>
Can I change the code above so that the text after a post’s “” tag opens up in a new browser page (tab)?
Following a Stackoverflow post, I added a single.php into my theme folder with the code below worked perfect i.e. my full post content is displayed in a new page when I click “read more…” link for any of my posts.
single.php