How to create sexy parent category styling
-
Is it possible to convert this code:
<?php $wp_query = $tmp_query; if (have_posts()) : $count = 0; ?> <ul> <?php while (have_posts()) : the_post(); $count++; ?> <li<?php if ($count==1) echo ' class="first"'; ?>> <div class="survivetitle"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></div> <a class="attachment" href="<?php the_permalink(); ?>"><?php fs_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '"'); ?></a> <p><?php echo fs_clean($post->post_excerpt, 300); ?>...</p> </li> <?php endwhile; ?> </ul> <?php else: ?> <p><?php fs_lang("No articles."); ?></p> <?php endif; ?>
so that it will automatically convert the div on the permalink/title to become the parent category of the post?
All posts on my site will either fall under the “thrive” or “survive” parent categories. I want to style the title’s of posts differently based on the parent category. I saw this suggested somewhere but it doesn’t use the parent category, it uses the category slug. I need to use the parent category slug. Not to mention, it produces an error message on my site. Help!:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>????<div class="?<?php?foreach((get_the_category()) as $cat)?{?echo $cat->category_nicename; ?}??>">? ?<h1><?php the_title(); ?></h1>?<?php the_content(); ?>?</div>?<?php endwhile; else: ?>?<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>?<?php endif; ?>
Seems so simple to do if you’re a programmer (which I”m not…) but I could not find a solution in the forums. Thanks in advance for your help.
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘How to create sexy parent category styling’ is closed to new replies.