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!

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.