Jump to content

Need Help With Wordpress Conditional Display


simcoweb

Recommended Posts

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!

 

<?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(); ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.