Show single post from category in an included php file?
-
There is a spot on my clients site for him to add a featured employee and have it show up in a little spot on the home page.
I have a file called inc_tophome.php that is used on the home page of my site. In that page i added this code:
<?php query_posts('category_name=featured-employee'); ?> <?php while (have_posts()) : the_post(); ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <a href="<?php the_permalink(); ?>" class="blogtitles" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a> <div style="width:135px;"> <?php the_post_thumbnail();?> </div> <div style="width:200px;"> <?php the_excerpt(); ?> </div> </div><!-- #post-## --> <?php endwhile; ?>
It kinda works but it removed my home page content text and duplicates itself. What am I doing wrong?
Here is the page: Website
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Show single post from category in an included php file?’ is closed to new replies.