wordpress - how to hide content on index page and show this when a post is opened? -


i use wordpress.

my idea stackoverflow. want on index page content doesn't show when opeded post content's shown, stackoverflow

<article id="container"> <?php if(have_posts()):?> <?php while(have_posts()): the_post();?>      <div class="post" id="post-<?php the_id(); ?>">          <div class="postmetadata small-font">             <ul>                 <li><?php bawpvc_views_sc('post_view', 'bawpvc_views_sc'); ?></li>                 <li><?php comments_popup_link();?></li>             </ul>         </div>          <div class="post-header">              <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>                 <?php get_template_part( 'content', get_post_format() ); ?>                 <?php the_excerpt(); ?>         </div><br />          <div class="date small-font">             <ul>                 <li><?php the_author()." " ;?></li>                 <li><?php the_modified_date();?></li>                 <li><?php the_category(', '." ")?></li>              </ul>         </div>        </div>  <?php endwhile; ?> 

with the_content() : enter image description here

with the_excerpt() : enter image description here

but want content doesn't show.

you must create 2 pages 1-index.php 2-single.php

index.php

<?php if(have_posts()):?> <?php while(have_posts()): the_post();?> <?php the_title(); ?> <?php endwhile; ?> <?php endif; ?> 

single.php

<?php if(have_posts()):?> <?php while(have_posts()): the_post();?> <?php the_title(); ?> <br> <?php the_content();?> <?php endwhile; ?> <?php endif; ?> 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -