Your HostICan Community  


Go Back   Your HostICan Community > SEO (Search Engine Optimization) & Marketing > Blogging

Blogging From hobbyists to The New York Times, blogging is the way to go to express your thoughts online. This forum is designed to discuss the entire subject, including picking the best software, creating themes, getting hits and, most important of all, posting your commentaries. Hard programming issues, though, should be discussed in our PHP / MySQL Assistance forum.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-25-2009, 11:07 AM
kachakagmu kachakagmu is offline
Junior Member
 
Join Date: Mar 2009
Posts: 4
Default categories in WordPress hosting

Hello,
the home page of my blog from my hosting are showing last 5 posts of all categories. I want to show the last 5 posts of all categories except one. That which remains outside index.php I want to move in sidebar.php . How is it possible?
Reply With Quote
  #2  
Old 07-25-2009, 11:46 AM
PEPSUN PEPSUN is offline
Junior Member
 
Join Date: Feb 2009
Posts: 5
Default Re: categories in WordPress hosting

Put this code at the beginning of index.php somewhere before the first "while". That will remove desired category number (in this case number 1):
PHP Code:
<?php query_posts('cat=-1'); ?>
In sidebar.php put this:
PHP Code:
<?php
//The Query
query_posts('cat=1&showposts=5');
//The Loop
if ( have_posts() ) : ?>
  <ul>
  <?while ( have_posts() ) : the_post(); ?>
    <li><?php the_title(); ?></li>
  <?php endwhile; ?>
  </ul>
<?php else: ?>
  No posts.
<?php endif; ?>
//Reset Query
wp_reset_query();
?>
Reply With Quote
Reply

Tags
categories, hosting, wordpress

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 03:40 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Copyright © 2003 - 2008 HostICan. All Rights Reserved.