Who here knows a little bit about Wordpress?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Young
    Bland for life
    • Nov 2004
    • 10468

    #1

    Who here knows a little bit about Wordpress?

    Lets say that you have 2 posts in a loop in order to have alternating looks for your posts.

    How does Wordpress handle this? Will it work?
    ★★★
  • adesadeleer
    Registered User
    • Dec 2006
    • 9

    #2
    Can you rephrase that ?

    Comment

    • Young
      Bland for life
      • Nov 2004
      • 10468

      #3
      Originally posted by adesadeleer
      Can you rephrase that ?
      I'd like my posts spread across different areas of my layout instead of the classic blog like feel. This is achieved on other sites like Kineda.com using Wordpress.

      I want to know how I can play with the loop in order to achieve this.
      ★★★

      Comment

      • DateDoc
        Outside looking in.
        • Feb 2005
        • 14243

        #4
        DjSap knows WP

        Comment

        • scouser
          marketer.
          • Aug 2006
          • 2280

          #5
          Like

          POST 1
          POST 2
          And (as an example) POST 1 has black background, POST 2 has red back ground?

          I am sure there is a better way, and i haven't tested it, but you could try this:

          <table style="background:<?php
          if ($currentbg == "#000000")
          $currentbg = "yellow";
          else {
          $currentbg = "#000000"
          }
          echo $currentbg;
          ?>">POST</table>


          And it would kind of do it for you. Sorry if it doesn't make sense. been up for about 27 hours so far...

          Comment

          • scouser
            marketer.
            • Aug 2006
            • 2280

            #6
            Actually, ignore my last post. Seems I read what you said, and just came up with my own idea of what you wanted. Sorry! (I need to go sleep now!)

            Comment

            • scouser
              marketer.
              • Aug 2006
              • 2280

              #7
              But btw, as it is in a loop, just do a counter, and do something like this:

              $counter = 0;

              while(whatever) {

              if ($counter == 0) {
              echo "<tr>";
              }
              echo "<td>post</td>";
              if ($counter == 2) {
              echo "</tr>";
              $counter = -1; //to make up for the counter++ below
              }
              $counter++;

              }
              // next bit fixes it up, incase it just ends in <tr><td>post</td>
              if ($counter == 1 || $counter == 2) {
              if ($counter == 1) {
              echo "<td></td>";
              }
              echo "</tr>";
              }
              }

              something like that, anyway. and add <table>/</table>. that is if it is in a table, ofcourse
              Last edited by scouser; 01-30-2007, 09:53 AM.

              Comment

              • DjSap
                Confirmed User
                • Jul 2002
                • 3869

                #8
                That's a very bulky way of doing it

                At the top of the page you put:
                <?$i;?>

                Then in index.php you sorround the post with this div:
                <div class="<?=($i&#37;2)?"bg1":"bg2";$i++;?>">

                In your style sheet you put:
                .bg1 {background-color: #FFF;}
                .bg2 {background-color: #000;}
                Blog Themes, TGP Design, Writing Services, Grunt Work
                ICQ: 66871495

                Comment

                • Sydney Sin
                  Confirmed User
                  • Jan 2007
                  • 223

                  #9
                  bump you

                  Comment

                  • cachondo
                    Confirmed User
                    • Sep 2004
                    • 808

                    #10
                    And if you separate the posts in categories and show each category in a different area?
                    medianetpay.com

                    Comment

                    • DjSap
                      Confirmed User
                      • Jul 2002
                      • 3869

                      #11
                      Originally posted by cachondo
                      And if you separate the posts in categories and show each category in a different area?
                      You want a different bg for each category on the front page or a different bg for each category in the category page?
                      Blog Themes, TGP Design, Writing Services, Grunt Work
                      ICQ: 66871495

                      Comment

                      • cachondo
                        Confirmed User
                        • Sep 2004
                        • 808

                        #12
                        I think he would like put news into different areas of the index such kineda.com

                        You can't for example in left shows news of category1 and in right shows news of category 2?
                        medianetpay.com

                        Comment

                        • DjSap
                          Confirmed User
                          • Jul 2002
                          • 3869

                          #13
                          You can do that but it takes some time.
                          Blog Themes, TGP Design, Writing Services, Grunt Work
                          ICQ: 66871495

                          Comment

                          • scouser
                            marketer.
                            • Aug 2006
                            • 2280

                            #14
                            Originally posted by DjSap
                            That's a very bulky way of doing it

                            At the top of the page you put:
                            <?$i;?>

                            Then in index.php you sorround the post with this div:
                            <div class="<?=($i%2)?"bg1":"bg2";$i++;?>">

                            In your style sheet you put:
                            .bg1 {background-color: #FFF;}
                            .bg2 {background-color: #000;}
                            Yeah. I wasn't really thinking straight, then

                            Comment

                            • TheSenator
                              Too lazy to set a custom title
                              • Feb 2003
                              • 13330

                              #15
                              Why can't people just make good original blogs the way they were meant to be. KISS is the principle I use and it has brought fortunes.

                              There is no short cuts unless you are a ruthless asshole that usually whines up dead.
                              ISeekGirls.com since 2005

                              Comment

                              • jayeff
                                Confirmed User
                                • May 2001
                                • 2944

                                #16
                                If I understand what you want correctly: areaA=a category and areaB=another category, query_posts() should do it:

                                http://codex.wordpress.org/Template_Tags/query_posts

                                Two snags. The first that you would need a counter, which only ticked up when the category matched the one you were looking for, but that is easily adapted from one of the previous posts, if not explained on the page I linked to. The second is that you would need multiple loops, as explained here:

                                http://codex.wordpress.org/The_Loop

                                Comment

                                • Fizzgig
                                  Registered User
                                  • Feb 2004
                                  • 9649

                                  #17
                                  I know a LITTLE about Wordpress. I don't know this.
                                  ---'-,-{@ Sassy Grrrl @}-'-,---

                                  Comment

                                  Working...