0
votes

My wordpress site was not showing blog posts content and not the single post content, so I have created a blog template and used a post grid plugin shortcode. So now the blog is showing fine, but when I click on "Read more" it directs to single post, which shows empty page, I have disabled and enabled plugins and checked my htaccess file also. Thank you.

<?php 
/*
* Template Name: Blog Post
*/
?>
<?php get_header(); ?>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>
		<?php wp_title('|', true, 'right'); ?>
	</title>
	<link href="<?php echo get_template_directory_uri(); ?>/css/bootstrap.min.css" rel="stylesheet">
	<link href="<?php echo get_template_directory_uri(); ?>/js/owl.carousel/owl.carousel.min.css" rel="stylesheet">

	<?php wp_head();?>
</head>


 <?php the_title(); ?>

<?php echo do_shortcode("[post_grid id='605']"); ?>




<?php get_footer(); ?>
1
Is it really empty? Did you View Source in your browser? Is it a completely white page? Either way, turn on error reporting. In your wp-config.php file, set WP_DEBUG to TRUE. That should cause it to show the error(s) that are causing the issue. - random_user_name
where is your single file code? - Aljay

1 Answers

0
votes

It looks like you are missing the <body> tag and also may be missing the WordPress loop in between the <body>...</body> tags.

Try this:

<body>
<?php while ( have_posts() ): the_post(); ?>

    <?php the_title(); ?>
    ...
<?php endwhile; ?>
</body>

Additionally the <?php get_header(); ?> already contains the HTML <head></head> and all the links and meta within, so you are essentially duplicating/overwriting it.

Try doing this:

<?php 
/*
* Template Name: Blog Post
*/
?>
<?php get_header(); ?>
<body>
<?php while ( have_posts() ): the_post(); ?>

    <?php the_title(); ?>
    ...
<?php endwhile; ?>
</body>

<?php get_footer(); ?>

Do also make sure that your header.php file doesn't actually contain the opening <body> tag out of the box though (footer.php should contain the closing tag), as this will determine whether you need the <body></body> tags in my code above.