![]() |
Wordpress Search Loop Statement
Ok, I have a search function and two seperate ways to display the posts.
If in a certain category then post this way else do this. Anyway, with the else I want to add a clear if the post count =1. How would I do this ? The loop PHP Code:
Code:
<article class="article-inspir drop-shadow curved curved-hz-1">PHP Code:
|
Just a guess ...
PHP Code:
|
Isn't that saying is the search = 1 then do the clear.
But I want if article-inspir = odd number then add clear to last div. Edit: I've just re-read my OP and I clearly ask for what you've put. However I need what I've said in this post. |
You can check whether the count is odd or even.
I'm just not sure if I'm inserting in the correct place ... Is this closer? PHP Code:
. |
No that's not working. I only want to count the loop for the first instance. Not the whole loop count.
|
doh!
I apologize that I cannot seem to understand. Do you have a working example, or a screenshot of the output and then point to what you mean? I think I'm getting lost in the fact that it's a loop, but perhaps at times there is only one thing in the loop, not several? |
http://admiretheweb.com/?s=aaa
As you can see its trying to display article-inspir with out a clear. Another search with more than one article-inspir works |
I've just thought, I don't want it on the odd divs. I want it on the last div, even if it's 1234567.
So this should essentially work, but it doesn't. Code:
<script type="text/javascript"> |
Let's do this ...
Put everything back to original, so that a search is a search. I want to see how every combination looks. An even number of finds. An odd number of finds. A single find. No finds. Then, after all results come out as designed, give me a search example of what should be different. By that I mean, give me search word that comes from the category that should render differently in the result. And describe how it would look different than the other search results. What I'm seeing now ... I think there is a situation now that is messing things up. When I search for "AAA", I'm getting two results. I'm guessing one of them is from the "special category" and the other is not. My guess is that "AAA" should really only render one result. Why is the other result showing up? That's why I want you to put the whole script back to its original state. When I search for "inspirations", I get one result (full width). When I search for "test", I get many results (looks good). When I search for something with odd number of results (looks good). . |
Wow, I appreciate the time your giving for this, immensely.
Anyway, you've got it right with the combinations, i'll try and explain. We'll separate them with wide (wide article/100%) inspir (short inspiration/50%). Wide always has clear float after, so that's not a problem. Inspir doesn't have a clear after, as they just stack up. However when introducing wide on the same page, it needs a clear after. I have done this by adding a clear after 2n (every two inspir's). However, when 1 inspir is displayed, it's fine. But when one inspir and a wide displays, it needs a clear float after. Again it can only have a clear float after 1 inspir if there is only 1 inspir, or if it is the last one otherwise inspir will stack and not go in 2's. Combinations: 1 or 1+ wide and 1 inspir.(problem as 1 inspir isn't cleared) 1 or 1+ wide and 2+ inspirs. FINE (add clear float on 2n inspir, wide always cleared) 1 inspir. FINE (obvious) 1 wide. FINE (obvious) 1+ wide. FINE (always clear after wide) 1+ inspir. FINE (no clear, but stack as all the same width) Oh, and the reason "aaa"" is coming up for wide, is because "aaa" is featured in that wide article. So the perfect one to test on. What I've just written is mega confusing, but I hope you understand. The simple way to fix this is to have wide as the same width as inspir, but that's boring, as you say, when it works, it looks great. |
Anybody ?
|
| All times are GMT +1. The time now is 04:51 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.