Title: Tabbed posts
Last modified: August 19, 2016

---

# Tabbed posts

 *  [Jess](https://wordpress.org/support/users/jessn/)
 * (@jessn)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/tabbed-posts-1/)
 * Quick question for you guys: on the home page of my WordPress site I want to 
   have a block with some tabs across the top, and each tab displays a different
   post, queried by a particular tag. I want the tab names to echo the category 
   that that post is in. I’m kind of close, but not quite as it’s not really working.
   Can anyone see what I’m doing wrong?
 *     ```
       <div class="tabber">
       <?php
       		$i = 1;
       		while($i < 5) {
       	?>
       	<div class="tabbertab">
   
        <h2><?php $featcat = the_category('tabber_'.$i); echo $featcat; ?></h2>
       		<?php query_posts('tag=home'); ?>
       <?php while (have_posts()) : the_post(); ?>
       		<h1><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h1>
       		<?php the_content(); ?>
       		<?php endwhile; ?>
   
               <div class="clear"></div>
       	</div>
       	 <?php
       			$i++;
       		}
       	?>
       </div>
       ```
   
 * Thanks so much!!

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/tabbed-posts-1/#post-1447776)
 * tag? category? what do you really want?
 * at them moment, you are listing a category name on top of the tab; then you query
   the same tag ‘home’ all the time.
 *  Thread Starter [Jess](https://wordpress.org/support/users/jessn/)
 * (@jessn)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/tabbed-posts-1/#post-1447854)
 * Yep. The tab echoes the name of the category that the post is in. I got it figured
   out:
 *     ```
       <?php query_posts('tag=home'); ?>
       <?php while (have_posts()) : the_post(); ?>
         <?php $category = get_the_category();  ?>
   
         <div class="tabbertab">
           <h2><? echo $category[0]->cat_name; ?></h2>
   
           <?php the_excerpt(); ?>
         </div>
   
       <?php endwhile; ?>
       ```
   

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

The topic ‘Tabbed posts’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Jess](https://wordpress.org/support/users/jessn/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/tabbed-posts-1/#post-1447854)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
