Forum

 
You must be logged in to post Login Register


Register? | Lost Your Password?

Search Forums:


 






Wildcard Usage:
*    matches any number of characters
%    matches exactly one character

make odd/even arraay in one of the loops?

Topic Locked
UserPost

8:09 am
September 10, 2009


neologan

Member

posts 17

1

Hi,

The loop that spits out this type of link: "// all other posts except the current post", i would like to change the code here so it has the ability to spit them out in an odd/even fashion. Can you show me how to do this? At present i tried this but it doesn't work 100%, please check link for the code i modded: http://pastebin.com/m6b0bb378.

With this mod, the first link it throws out is certainly using the code for //odd, but then all further links it throw out use the //even code. I want it to do this:

(link 1 -odd) (link 2 -even) (link 3 -odd) (link 4 -even)…etc. (i shant explain why i need this, but i really do.

I don't know the correct solution :(

I know this falls outside of the plug, but i would really appreciate your help to solve this. This plug is important to a feature i'm working on and this is the final issue before i'm in serial post nirvana.

10:00 am
September 10, 2009


Ade

Admin

posts 1140

2

It's not clear to me what you're trying to do, so it's difficult to say what's wrong with your code.

What is this supposed to do?

if($findpost->ID & 1){

Dynamic Content Gallery: Have you read the Configuration Guide and FAQ?

7:10 pm
September 10, 2009


neologan

Member

posts 17

3

Post edited 5:22 pm – September 10, 2009 by neologan


I'll try to explain visually. On my setup, i will never use: Include current post in list of Serial Posts, and in your code i've changed

ORDER BY $wpdb->posts.post_date

to DESC.

Currently, your plugin once setup correctly, spits out each link in a set like this

  • link 1
  • link 2
  • link 3
  • link 4

This is what i am trying to acheive from your plugin using divs instead of list, and some css.

How? Well it's impossible right now because link 1 and 3 (odd numbers) need to be float:left in css, and links 2 and 4 (even) need to be float:right. With just one call as it currently is in your plug, all the links will have the same styling.

I'm hoping it all clicks now, because in the code i posted, it shows how i was trying (and failing) to get your plug to make the code at: “// all other posts except the current post” use an odd/even loop so i could acheive this. The actual code in both odd and even will be the same, all i would change is the styling so they look different

Even more info: Using the code i showed you, this is what i currently have got to:

Hopefully this explains what + 1 in my code is doing (which is wrong for what i want, i know) Also, please remember that the story in red, is actually the first called in the loop, because i have change your plug to do “order DESC”

1:49 am
September 11, 2009


neologan

Member

posts 17

4

any ideas?

5:44 am
September 11, 2009


neologan

Member

posts 17

5

i've abandoned this idea now.