Support » Plugins » Alternate query_posts output

  • Hi,

    How can I get the query_posts to alternate the output?

    Ex; instead of this:

    <h1>Header 1</h2>
    <p>text</p>
    <!-- end of post -->
    <h1>Header 2</h2>
    <p>text</p>
    <!-- end of post -->
    <h1>Header 2</h2>
    <p>text</p>
    <!-- end of post -->

    I’d like to get this:

    <h1>Header 1</h2>
    <p>text</p>
    <!-- end of post -->
    <h1 class="hd2">Header 2</h2>
    <p>text</p>
    <!-- end of post -->
    <h1>Header 2</h2>
    <p>text</p>
    <!-- end of post -->

    You know what I mean??? So I can get the posts presented in an alternate way from each other…

    Thanks for the help in advance.

Viewing 1 replies (of 1 total)
  • You are opening <h1> tags and closing <h2> tags, just so you know.

    You want to do something like this:

    // just inside your loop
    $class = ('hd2' == $class) ? '' : 'hd2';
    // whatever code needs to be here ?>
    <h1 <?php if ($class) echo 'class="'.$class.'"'; ?> >Header 1</h1>
    <p>text</p>
    <!-- end of post -->
Viewing 1 replies (of 1 total)
  • The topic ‘Alternate query_posts output’ is closed to new replies.