simcoweb Posted February 8, 2012 Share Posted February 8, 2012 Summary: We want the display of the posts to be a simple unordered list with titles only when someone clicks on a tag in the tag cloud. We've accomplished this. But, we find that the category display was also affected. Both use the archive.php file to generate the output. Therefore, what we need is a conditional statement 'if is_category()' do this and 'if is_title_tag()' do that. Just need a bit of help with the structure if possible. Here's the archive.php file code before we modified it to display the list: <?php get_header(); ?> <ul class="double-cloumn clearfix"> <li id="left-column"> <ul class="blog-main-post-container clearfix"> <?php if (is_category)) : if (have_posts()) : global $show_author; $show_author = 1; while (have_posts()) : the_post(); setup_postdata($post); include(TEMPLATEPATH."/functions/fetch-list.php"); endwhile; else : ocmx_no_posts(); endif; ?> </ul> <?php motionpic_pagination("clearfix", "pagination clearfix"); ?> </li> <?php get_sidebar(); ?> </ul> <?php get_footer(); ?> And here's the modified version to show just the titles in a list format. Works fine for the tag cloud links, but now forces category display to do the same: <?php get_header(); ?> <ul class="double-cloumn clearfix"> <li id="left-column"> <h4 class="section-title"><?php _e("Topics containing", "ocmx");?> "<em><?php single_tag_title(); ?></em>"</h4> <ul class="blog-main-post-container clearfix"> <?php while (have_posts()) : the_post(); ?> <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li> <?php endwhile;?> </ul> <?php motionpic_pagination("clearfix", "pagination clearfix"); ?> </li> <?php get_sidebar(); ?> </ul> <?php get_footer(); ?> Any help is always appreciated! Quote Link to comment https://forums.phpfreaks.com/topic/256699-need-help-with-wordpress-conditional-display/ Share on other sites More sharing options...
digibucc Posted February 8, 2012 Share Posted February 8, 2012 <?php get_header(); ?> <ul class="double-cloumn clearfix"> <li id="left-column"> <?php if (!is_category()) { ?><h4 class="section-title"><?php _e("Topics containing", "ocmx");?> "<em><?php single_tag_title(); ?></em>"</h4> <?php } ?> <ul class="blog-main-post-container clearfix"> <?php if (!is_category()) { while (have_posts()) : the_post(); ?> <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li> <?php endwhile; } else { if (have_posts()) : global $show_author; $show_author = 1; while (have_posts()) : the_post(); setup_postdata($post); include(TEMPLATEPATH."/functions/fetch-list.php"); endwhile; else : ocmx_no_posts(); endif; }?> </ul> <?php motionpic_pagination("clearfix", "pagination clearfix"); ?> </li> <?php get_sidebar(); ?> </ul> <?php get_footer(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/256699-need-help-with-wordpress-conditional-display/#findComment-1315976 Share on other sites More sharing options...
simcoweb Posted February 8, 2012 Author Share Posted February 8, 2012 You, Sir, are a life saver. Pasted it in and it worked perfectly. I'll study my version vs. yours so I can learn how that's done for future use. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/256699-need-help-with-wordpress-conditional-display/#findComment-1315979 Share on other sites More sharing options...
digibucc Posted February 8, 2012 Share Posted February 8, 2012 :-) glad to help Quote Link to comment https://forums.phpfreaks.com/topic/256699-need-help-with-wordpress-conditional-display/#findComment-1315982 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.