using get_the_category function and styling
-
ok so im working on a custom theme for my blog and becasue I want each category to have its own style im using the get_the_category function. But when I use this all my post end up stacked on top of each other, you can see this here http://www.flickr.com/photos/21455233@N08/2449324526/, this is what I would like it to look like http://www.flickr.com/photos/21455233@N08/2447470364/. The code that im using is as follows:
<?php get_header(); ?> <body> <div id="networkcontain"> <div id="networkbar"> </div> </div> <div id="tphead"> <a href="/"><h1>Cerebral Black Hole</h1></a> </div> <div id="containertp"> <div id="contentleft"> <div class="tf_body"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php the_date('','<h2>','</h2>'); ?> <div class="post <?php foreach((get_the_category()) as $cat) { echo $cat->category_nicename; } ?>" id="post-<?php the_ID(); ?>"> <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2> <div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> — <?php the_tags(__('Tags: '), ', ', ' — '); ?> <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?> </div> <div class="entryContent"> <?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: ?> <?php _e('Sorry, no posts matched your criteria.'); ?> <?php endif; ?> <?php posts_nav_link(' — ', __('« Older Posts'), __('Newer Posts »')); ?> </div> <?php get_footer(); ?> <?php get_sidebar(); ?> </div>
Any help with this would be greatfully recieved as this kis driving me mad, and I cant progress.
- The topic ‘using get_the_category function and styling’ is closed to new replies.