Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Axel Rhodes Scholar
May 12, 2001

Courage Reactor

clockworkjoe posted:

<?php if (($wp_query->post_count) % 2) : ?> is not working to register odd posts as odd.

$wp_query->post_count is the number of posts returned by the query, so it's always even because the number of posts you're getting is always even (always 4?)

Right now you're doing (pardon the pseudo-code)
code:
if (number of posts is even){
  loop over all the posts, do X
}else{ // number of posts is odd
  loop over all the posts, do Y
}
Note you've got two separate loops over all the posts, and you're picking one depending on how many posts there are.

what you seem to want to do is more like:
code:
loop over all the posts{
  if(this is an even post){
    do X
  }else{ // it's an odd post
    do Y
  }
}
so you'll have one while loop, with an if inside it.

I _think_, though I'm not a wp expert, that $wp_query->current_post can be used to check if the current post is 'even' or 'odd' (if (($wp_query->current_post) % 2) )

Adbot
ADBOT LOVES YOU

clockworkjoe
May 31, 2000

Rolled a 1 on the random encounter table, didn't you?
thanks for the info! Unfortunately, it's still not working quite right. It's treating all 4 posts as odd posts.

code:
<?php
/*
Template Name: Post Gallery
*/
?>
<?php query_posts (4); ?>
<table>

<?php if (have_posts()) : ?>

<?php if (($wp_query->current_post) % 2) : ?>

     <?php while (have_posts()) : the_post(); ?>
ODD POST FORMAT
     <?php endwhile; ?>

  <?php else : ?>

     <?php while (have_posts()) : the_post(); ?>
EVEN POST FORMAT
     <?php endwhile; ?>
  <?php endif; ?>

<?php else : ?>


<?php posts_nav_link('','','&laquo; Previous Entries') ?> 
<?php posts_nav_link('','Next Entries &raquo;','') ?>
<?php endif; ?>
I think the issue is that when the code gets to the have_posts, it processes all 4 posts as odd posts before continuing.

Axel Rhodes Scholar
May 12, 2001

Courage Reactor

Oh, you've still got two 'while' statements inside your 'if' statement that tests for even-ness. The while statement needs to go on the outside, so you're sequentially testing each post for odd/even-ness in turn.

Think more like:
code:
<?php while (have_posts()) : the_post(); ?>
  <?php if (($wp_query->current_post) % 2) : ?>
    ODD POST FORMAT
  <?php else : ?>
    EVEN POST FORMAT
 <?php endif; ?>
<?php endwhile ?>
sort of thing.

KuruMonkey
Jul 23, 2004

Twiin posted:

"Some people, when confronted with a problem, think 'I know, I'll use regular expressions.' Now they have two problems."

The main cause of this phenomenon, of course, is stubbornly attempting to apply regular expressions to irregular data...

Herr FLSH
Feb 10, 2006

I cried myself to sleep that night but woke up to an answer on stackexchange :)

If anyone is/was interested: http://wordpress.stackexchange.com/questions/9216/regex-problem-in-an-add-rewrite-rule

clockworkjoe
May 31, 2000

Rolled a 1 on the random encounter table, didn't you?

dazjw posted:

Oh, you've still got two 'while' statements inside your 'if' statement that tests for even-ness. The while statement needs to go on the outside, so you're sequentially testing each post for odd/even-ness in turn.

Think more like:
code:
<?php while (have_posts()) : the_post(); ?>
  <?php if (($wp_query->current_post) % 2) : ?>
    ODD POST FORMAT
  <?php else : ?>
    EVEN POST FORMAT
 <?php endif; ?>
<?php endwhile ?>
sort of thing.

thanks! I got it formatted right but I have a new problem. I'm using:

<?php query_posts ('posts_per_page=4'); ?> to get the posts and <?php posts_nav_link('sep','previous ','next '); ?> to create nav links to page through multiple pages of posts.

the problem is that I'm not going through the older posts. So if I go to site.com/?page_id=42 it shows posts 8 to posts 5. Then if I click on next to go to site.com/?page_id=42&paged=2 it still shows posts 8 to 5 instead of posts 4 to 1.

Axel Rhodes Scholar
May 12, 2001

Courage Reactor

Does changing
code:
<?php query_posts ('posts_per_page=4'); ?> 
with

code:

<?php 
global $query_string;
query_posts( $query_string . '&posts_per_page=4' ); ?>
help? (I'm going off http://codex.wordpress.org/Function_Reference/query_posts which seems to indicate this would do what you want, I'm afraid I don't have something suitable to test this with myself at the moment)

micropenis
Jul 19, 2004
An '04 Mac user from the UK. What's worse?
What's the best way to update Wordpress from an iPhone? Asking on behalf of my friend. He tried the Wordpress app but said it's quite crashy.

Any plugins that make the admin CSS mobile-friendly when logged in from iPhone Safari?

revmoo
May 25, 2006

#basta

micropenis posted:

What's the best way to update Wordpress from an iPhone? Asking on behalf of my friend. He tried the Wordpress app but said it's quite crashy.

Any plugins that make the admin CSS mobile-friendly when logged in from iPhone Safari?

Wordpress by email is probably the easiest way, it's built in.

rugbert
Mar 26, 2003
yea, fuck you
Im looking for a plug in like AddThis, but one that shows the number of facebook likes and number of tweets but also lets you email the post, bookmark ect ect. Doesnt look like the wordpress version has that feature.

Kitsch!
Jul 27, 2006

God made Adam and Eve, not Fluffy and Eve.

rugbert posted:

Im looking for a plug in like AddThis, but one that shows the number of facebook likes and number of tweets but also lets you email the post, bookmark ect ect. Doesnt look like the wordpress version has that feature.

I know there's plug-ins like Sociable but I could never get it to look right on my blog (formatting issues). I use separate plug-ins for FB like (Facebook Likes You!), FB share (Facebook Share) and a Tweet button (Twitter Goodies). I do need to get something for e-mail and possibly Digg/Reddit. Or just get one that integrates all and I can pick and choose what I want.

Kitsch! fucked around with this message at 16:57 on Feb 17, 2011

Gaff Tape
Dec 31, 2005
Black sticky absorbant bliss.
I'm using the Workaholic theme by Graph Paper Press, and for some reason I need to have all of the files from the parent theme directory in the child theme directory, or their respective elements don't display on my site.

For example, if I delete header.php from the child theme, but it exists in the parent theme, I still don't have a header on the site itself.

Am I misunderstanding child themes completely? I thought the child directory was only for files that you were going to alter from their original state, and everything not found in the child directory was imported from the parent directory?

clockworkjoe
May 31, 2000

Rolled a 1 on the random encounter table, didn't you?
I finally found a way to get the pagination to work. It was pretty complex actually. This page has a good tutorial on it if anyone wants to know. http://shibashake.com/wordpress-theme/wordpress-query_posts-and-get_posts

babydonthurtme
Apr 21, 2005
It's my first time...
Grimey Drawer

Gaff Tape posted:

I'm using the Workaholic theme by Graph Paper Press, and for some reason I need to have all of the files from the parent theme directory in the child theme directory, or their respective elements don't display on my site.

For example, if I delete header.php from the child theme, but it exists in the parent theme, I still don't have a header on the site itself.

Am I misunderstanding child themes completely? I thought the child directory was only for files that you were going to alter from their original state, and everything not found in the child directory was imported from the parent directory?

That sounds like their theme might be the problem. You're not misunderstanding child themes at all-- you should be able to just have only the altered files in your child directory. If I were you, I'd try going through the major theme files like index.php and loop.php to see if they're written correctly, as well as checking on the comments at the top of your child theme's style.css file. That should match something like this:

code:
/*
Theme Name: Child Theme Name
Description: Child theme for the Whatever Theme
Template: [lowercase name for parent theme]
*/

Gaff Tape
Dec 31, 2005
Black sticky absorbant bliss.

babydonthurtme posted:


There's no loop.php file in my theme's directory - could that be the issue?

Style.css has the correct entries also. I'm not versed enough in PHP to know what else to look for. It works fine if I put all of the theme files in the child folder, but I'm assuming that kind of defeats the purpose of child themes when it comes to updating, correct? If not, I'll just settle for that.

Graph Paper Press seems pretty sure that this theme can be used as a child fairly effectively..

babydonthurtme
Apr 21, 2005
It's my first time...
Grimey Drawer

Gaff Tape posted:

There's no loop.php file in my theme's directory - could that be the issue?

Style.css has the correct entries also. I'm not versed enough in PHP to know what else to look for. It works fine if I put all of the theme files in the child folder, but I'm assuming that kind of defeats the purpose of child themes when it comes to updating, correct? If not, I'll just settle for that.

Graph Paper Press seems pretty sure that this theme can be used as a child fairly effectively..

Huh, the absence of loop.php might or might not be the issue, depending on how they structured the php of their other files. A couple more questions-- what theme is supposed to be the parent theme? Are they going off of the TwentyTen theme, or their own thing? Because that might be the real issue, if they didn't give you the right parent theme files; if those aren't available (i.e. they aren't activated in your WordPress install, aren't in the right place on your server, etc), that could produce the results you're talking about here.

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:
I need to install a theme twice... I want to make some adjustments in the editor but have a "clean copy" uploaded to reset back from. What details do I need to change to allow a second install?

hmm yes
Dec 2, 2000
College Slice
Duplicate the folder => change the theme name at the very top of theme_dir/style.css

Gaff Tape
Dec 31, 2005
Black sticky absorbant bliss.

babydonthurtme posted:


That sounds like the issue, I'm just really in love with the styling of the theme. Maybe I should just suck it up and figure out how to do everything I want from scratch.

babydonthurtme
Apr 21, 2005
It's my first time...
Grimey Drawer

Gaff Tape posted:

That sounds like the issue, I'm just really in love with the styling of the theme. Maybe I should just suck it up and figure out how to do everything I want from scratch.

Have you talked to the guys that sold you the theme yet? It might just be a setup issue they didn't explain properly, and from what I saw of their site, they seem the kind of people who'd be willing to help with support if you got the wrong files somehow. It really looks like a good theme, and I bet you can get things straightened out if you pester them a bit.

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:
cheers atastypie

I am creating my themes in psd2cssonline.com .... I know I know!

the question is how do I make a Nav Bar that will auto populate with the pages? Is there a decent tutorial for this or is something easy?

Gaff Tape
Dec 31, 2005
Black sticky absorbant bliss.

babydonthurtme posted:

Have you talked to the guys that sold you the theme yet? It might just be a setup issue they didn't explain properly, and from what I saw of their site, they seem the kind of people who'd be willing to help with support if you got the wrong files somehow. It really looks like a good theme, and I bet you can get things straightened out if you pester them a bit.

Unfortunately it was a free theme (cheap college student), and they're die hard about not supporting users who aren't subscribers (i.e. have paid for access to the premium themes.)

No worries, I'll keep playing with it.

LuckySevens
Feb 16, 2004

fear not failure, fear only the limitations of our dreams

I'm new to wordpress and I'm having trouble with a blog page I just whipped up. For some reason its not looping through and its only displaying the most recent post. I've been tweaking my code but I can't seem to find a way for it to display a list, can anyone help me?

http://pastebin.com/utTHWsuu

cocteau
Nov 28, 2005

The best Darcy.

Gaff Tape posted:

I'm using the Workaholic theme by Graph Paper Press, and for some reason I need to have all of the files from the parent theme directory in the child theme directory, or their respective elements don't display on my site.

For example, if I delete header.php from the child theme, but it exists in the parent theme, I still don't have a header on the site itself.

Am I misunderstanding child themes completely? I thought the child directory was only for files that you were going to alter from their original state, and everything not found in the child directory was imported from the parent directory?

Do you have both the parent theme and the child theme installed?

cocteau
Nov 28, 2005

The best Darcy.

LuckySevens posted:

I'm new to wordpress and I'm having trouble with a blog page I just whipped up. For some reason its not looping through and its only displaying the most recent post. I've been tweaking my code but I can't seem to find a way for it to display a list, can anyone help me?

http://pastebin.com/utTHWsuu

What theme are you using? Do you have a link to the website itself?

LuckySevens
Feb 16, 2004

fear not failure, fear only the limitations of our dreams

cocteau posted:

What theme are you using? Do you have a link to the website itself?

http://www.sixthstreetcareers.com/

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:
I have a site that is almost ready, at least on my pc it is!
I use Chrome for everything and on my pc and in chrome its done!Oon a friends in Chrome and on mine in all other browsers its messed up. I have 2 CSS files attached, changes to style.css are fine but changes to *mytheme*.css is borked.

Any ideas?

Ned
May 23, 2002

by Hand Knit
Do you have a reset.css that sets everything to a standard? Each browser has their own defaults for things like lists and paragraphs.

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:

Ned posted:

Do you have a reset.css that sets everything to a standard? Each browser has their own defaults for things like lists and paragraphs.

Yes I have a reset.css but really dont want to undo allt he work in getting the theme looking correct. It seems some browsers pull from style.css and some from theme.css... is that right?

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:
I have a stupid issue. I have set a Div to auto height and the Div below it has been covered. its here http://www.total-outdoors.co.uk you can just about see the grey bar, which is the footer!

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:
Does anyone know a plugin where i can print a ticket with a specific date and serial number?

I am looking to make is people can by a ticket to fish a lake and print their own day ticket, which has a serial number the bailiff can tell is legit or not by the format.

Kill All Cops
Apr 11, 2007


Pacheco de Chocobo



Hell Gem

thegasman2000 posted:

I have a stupid issue. I have set a Div to auto height and the Div below it has been covered. its here http://www.total-outdoors.co.uk you can just about see the grey bar, which is the footer!

Probably becuase youre using absolute positioning for absolutely loving everything

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:

Lady Galaga posted:

Probably becuase youre using absolute positioning for absolutely loving everything

I take it thats bad?

I have used the theme Inferno and I love the opacity background, here is the example https://www.blackops-ps3.com How do I make a div like this manually?

cocteau
Nov 28, 2005

The best Darcy.

thegasman2000 posted:

I take it thats bad?

I have used the theme Inferno and I love the opacity background, here is the example https://www.blackops-ps3.com How do I make a div like this manually?

You really need to learn CSS. Here's a site that I like: http://css-tricks.com/. Alternately there are tons of other sites to learn basic CSS as well as use cool CSS 3 effects.

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:
I bought the E-Commerce Gold Cart Plugin and it broke the cart?!? Can anyone see an obvious errors here? Even the wordpress 3.1 Admin bar has messed up!

http://total-outdoors.co.uk/checkout.html

cocteau
Nov 28, 2005

The best Darcy.

thegasman2000 posted:

I bought the E-Commerce Gold Cart Plugin and it broke the cart?!? Can anyone see an obvious errors here? Even the wordpress 3.1 Admin bar has messed up!

http://total-outdoors.co.uk/checkout.html

Is the plugin compatible with 3.1? That could be an issue, some plugins aren't playing nice with the new version yet because the devs haven't updated them.

excidium
Oct 24, 2004

Tambahawk Soars

thegasman2000 posted:

I bought the E-Commerce Gold Cart Plugin and it broke the cart?!? Can anyone see an obvious errors here? Even the wordpress 3.1 Admin bar has messed up!

http://total-outdoors.co.uk/checkout.html

What about it is broken? I have a little experience using it, seemed OK to me without actually buying anything.

thegasman2000
Feb 12, 2005
Update my TFLC log? BOLLOCKS!
/
:backtowork:

excidium posted:

What about it is broken? I have a little experience using it, seemed OK to me without actually buying anything.



I cant remove or update anything in the cart?

Can you downgrade easily?

excidium
Oct 24, 2004

Tambahawk Soars

thegasman2000 posted:

I cant remove or update anything in the cart?

Can you downgrade easily?

I'm on your live site now, added the tent to my cart, updated the quantity to 4 and then removed it. Seems like it works fine?

Adbot
ADBOT LOVES YOU

bobthecheese
Jun 7, 2006
Although I've never met Martha Stewart, I'll probably never birth her child.

excidium posted:

I'm on your live site now, added the tent to my cart, updated the quantity to 4 and then removed it. Seems like it works fine?

It looks like he's got some rogue javascript or something there. When I tried to update or remove an item in the cart, it refreshed the page on click.

Using chrome 10 on linux, if that helps. Seems to work fine in firefox.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply