• Hey ,

    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

    https://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>&nbsp;
    						Posted on <?php the_time('M'); ?>&nbsp;&nbsp;<?php the_time('j'); ?>&nbsp;&nbsp;<?php the_time('Y'); ?>
    					</span>
    					<span>
    						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    						<i class="fa fa-comments-o"></i>&nbsp;
    						<?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 these things ?

    Thanks !
    Srivin Prabhash

  • The topic ‘single.php not working when remove index.php from permalink’ is closed to new replies.