Title: Posts disappeared
Last modified: August 19, 2016

---

# Posts disappeared

 *  [jarin](https://wordpress.org/support/users/jarin/)
 * (@jarin)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/posts-disappeared-1/)
 * Hi
 * the site in question: [http://www.thebeepseals.com](http://www.thebeepseals.com)
 * I amended index.php per another post on here so as to show only posts from the
   news category on the home page. this was working fine until today. it seems like
   perhaps the posts have expired? if i click ‘older posts’ they appear but they
   no longer appear by default on the home page. i’m new to wordpress so not sure
   how to approach fixing this. basically i want the last 5 posts of the news page
   to appear on the home page by default and not expire.
 * here is my index.php code as it is now:
 *     ```
       <?php
       get_header();
       ?>
   
       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
       <?php if ( (in_category('1')) || !is_home() ) { ?>
       <!-- Output the post here -->
       <?php the_date('','<h2>','</h2>'); ?>
   
       <div class="post" id="post-<?php the_ID(); ?>">
       	 <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
   
       	<div class="storycontent">
       		<?php the_content(__('(more...)')); ?>
       	</div>
   
       	<div class="feedback">
       		<?php wp_link_pages(); ?>
       		<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
       	</div>
   
       </div>
   
       <?php comments_template(); // Get wp-comments.php template ?>
   
       <?php } ?>
       <?php endwhile; else: ?>
       <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
       <?php endif; ?>
   
       <?php posts_nav_link(' — ', __('&laquo; Newer Posts'), __('Older Posts &raquo;')); ?>
   
       <?php get_footer(); ?>
       ```
   

Viewing 10 replies - 1 through 10 (of 10 total)

 *  [whooami](https://wordpress.org/support/users/whooami/)
 * (@whooami)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/posts-disappeared-1/#post-715396)
 * there isnt anything wrong with that code, assuming news is category id #1 OR 
   is_home is your index.php.
 * [http://www.thebeepseals.com/?cat=1](http://www.thebeepseals.com/?cat=1) = (news
   is 1)
 * Plugins used are?
 *  Thread Starter [jarin](https://wordpress.org/support/users/jarin/)
 * (@jarin)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/posts-disappeared-1/#post-715399)
 * no plugins..
    why have the news posts disappeared from the home page tho? thanks
 *  [rudolf45](https://wordpress.org/support/users/rudolf45/)
 * (@rudolf45)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/posts-disappeared-1/#post-715401)
 * **!**is_home()
    This means “is NOT home”, so the code is doing what it is supposed
   to do: hide the posts on home page, because your code is saying show the posts
   only when we are NOT on the homepage.
 *  [whooami](https://wordpress.org/support/users/whooami/)
 * (@whooami)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/posts-disappeared-1/#post-715405)
 * No
    that code says:
 * If in cat 1 OR not at home. ONLY one of those needs to be true, or both.
 * If you want to prove that out, go plug it on your own site. Trust me, it’s right.
 *  Thread Starter [jarin](https://wordpress.org/support/users/jarin/)
 * (@jarin)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/posts-disappeared-1/#post-715406)
 * ah ok..so i’ve taken out the “!” making the if clause into:
 * `<?php if ( (in_category('1')) || is_home() ) { ?>`
 * but now it’s showing latest posts from all categories..
 * how would i get it to only show latest posts from news (ie cat 1)?
 * thx
 *  [whooami](https://wordpress.org/support/users/whooami/)
 * (@whooami)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/posts-disappeared-1/#post-715408)
 * if thats the case the trouble is with the in_category bits NOT the code itself.
   what you did was you made the second variable true..
 * || = or
 * Your code know says :
 * if in category 1 OR at home: do something.
 * and its not displaying ALL posts .. its left out the category 1 ones.
 *  [rudolf45](https://wordpress.org/support/users/rudolf45/)
 * (@rudolf45)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/posts-disappeared-1/#post-715409)
 * That code will definitely not do it.
    Search: [http://wordpress.org/support/topic/156069?replies=9](http://wordpress.org/support/topic/156069?replies=9)
   lots of options there.
 *  [whooami](https://wordpress.org/support/users/whooami/)
 * (@whooami)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/posts-disappeared-1/#post-715410)
 * change this:
 * `<?php if ( (in_category('1')) || !is_home() ) { ?>`
 *  to this:
 * `<?php if (in_category('1') || !is_home() ) { ?>`
 * My php guru insists there isnt any functional diff. between those but I disagree.
   That will fix it.
 * Where is Otto when you need him??
 *  Thread Starter [jarin](https://wordpress.org/support/users/jarin/)
 * (@jarin)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/posts-disappeared-1/#post-715425)
 * hey whooami..thanks for that..however i think im back at square one where the
   posts from the news category have disappeared from the home page. i suspect it’s
   because they are several days old? how can i keep them up there permanently (
   the most recent 5 posts at least)..?
 * rudolf45: im checkin out that link thanks for that
 *  Thread Starter [jarin](https://wordpress.org/support/users/jarin/)
 * (@jarin)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/posts-disappeared-1/#post-715427)
 * ok guys i solved this. it now only shows cat 3 on the home page! thanks!
 * here’s the code if anyone’s interested:
 *     ```
       <?php
       get_header();
       ?>
   
       <?php if (is_home() ) { ?>
       <?php query_posts('cat=1'); ?>
       <?php } ?>
       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
   
       <!-- Output the post here -->
       <?php the_date('','<h2>','</h2>'); ?>
   
       <div class="post" id="post-<?php the_ID(); ?>">
       	 <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
   
       	<div class="storycontent">
       		<?php the_content(__('(more...)')); ?>
       	</div>
   
       	<div class="feedback">
       		<?php wp_link_pages(); ?>
       		<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
       	</div>
   
       </div>
   
       <?php comments_template(); // Get wp-comments.php template ?>
   
       <?php endwhile; else: ?>
       <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
       <?php endif; ?>
   
       <?php posts_nav_link(' — ', __('&laquo; Newer Posts'), __('Older Posts &raquo;')); ?>
   
       <?php get_footer(); ?>
       ```
   

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Posts disappeared’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 10 replies
 * 3 participants
 * Last reply from: [jarin](https://wordpress.org/support/users/jarin/)
 * Last activity: [18 years, 1 month ago](https://wordpress.org/support/topic/posts-disappeared-1/#post-715427)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
