I’m very new to wordpress theme developing and just started to make a one with bootstrap 3.I’m running wordpress on my localhost on nginx webserver.I created index.php file and make posts listed on it with read more buttons and linked their titles to post’s permalinks and created the single.php also.It also working fine but i feel there’s something wrong with my codes.
My post’s permalinks looks like this.Always showing index.php
http://www.blog.dev/index.php/%postname
so i change post’s permalinks to custom and removed that “index.php”. After that my signle.php doesn’t working. I mean it gives me a error 404.
Here’s my single.php
<!-- Including Header -->
<?php get_header(); ?>
<!-- Post Cover -->
<div id="postCover" class="container-fluid"></div>
<div id="postContainer" class="container">
<div class="col-md-2"></div>
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-heading">
<?php the_title(); ?>
</div>
<div class="panel-body">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('post-thumbnail', array( 'class' => "img-responsive"));
}
?>
<div id="posDetailsContainer" class="container-fluid text-left">
<span>
<i class="fa fa-calendar"></i>
Posted on <?php the_time('M'); ?> <?php the_time('j'); ?> <?php the_time('Y'); ?>
</span>
<span>
<i class="fa fa-comments-o"></i>
<?php comments_number( 'No Comments', '1 Comment', '% Comments' ); ?>
</span>
</div>
<!-- Post Content Display -->
<div id="postContent" class="container-fluid">
<?php
if ( have_posts() ) : while ( have_posts() ) : the_post();
the_content();
endwhile;
endif;
?>
</div>
</div>
</div>
</div>
<div class="col-md-2"></div>
</div>
How to fix this ?
Thanks !
Srivin Prabhash
I think you have done some mistake in index.php.
Put this code in your index.php file.
Still if you face this problem remove your .htaccess file from root directory and change permalink setting.Tack backup before delete .htaccess file.
I hope this will work for you.
Add .htaccess file on root folder and paste this code inside the file
and then go to setting->permalink and select postname. it will works