GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Who here knows a little bit about Wordpress? (https://gfy.com/showthread.php?t=701093)

Young 01-30-2007 11:36 AM

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 01-30-2007 11:38 AM

Can you rephrase that ?

Young 01-30-2007 11:41 AM

Quote:

Originally Posted by adesadeleer (Post 11819274)
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.

DateDoc 01-30-2007 11:43 AM

DjSap knows WP

scouser 01-30-2007 11:44 AM

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... :(

scouser 01-30-2007 11:49 AM

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!)

scouser 01-30-2007 11:52 AM

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

DjSap 01-30-2007 11:57 AM

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;}

Sydney Sin 01-30-2007 11:58 AM

bump you

cachondo 01-30-2007 12:00 PM

And if you separate the posts in categories and show each category in a different area?

DjSap 01-30-2007 12:02 PM

Quote:

Originally Posted by cachondo (Post 11819418)
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?

cachondo 01-30-2007 12:16 PM

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?

DjSap 01-30-2007 12:31 PM

You can do that but it takes some time.

scouser 01-30-2007 11:10 PM

Quote:

Originally Posted by DjSap (Post 11819395)
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 :)

TheSenator 01-30-2007 11:16 PM

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.

jayeff 01-30-2007 11:26 PM

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

Fizzgig 01-31-2007 12:58 AM

I know a LITTLE about Wordpress. I don't know this.


All times are GMT -7. The time now is 04:48 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123