Thread Starter
Alvin
(@akoetsier)
Hi Chewbears , im sorry it doesnt work.
If you like i can send you the themefiles?
If so please send an email to info@luchthavenpersoneel.nl and i will reply to that.
akoetsier,
did you add:
class=”<?php echo $odd_or_even; ?>”
t-p
Link to your page.
I am working with the default twentyten theme on a test box. Try to mod those lines in page.php
Also
class=”<?php echo $odd_or_even; ?>”
I didn’t post the closing quotes.
Moderator
t-p
(@t-p)
I didn’t post the closing quotes.
in actual code (in loop.php) i don’t have those quotes. By mistake I added here. sorry.
Try to mod those lines in page.php
I tried. No color in posts. but as I mentioned before, I see different colors (odd and even) in comments on the comment page.
I am working with the default twentyten theme
After done, please share your solution. I am new to all this. step by step instructions will be appreciated.
Thanks again chewbears:
No idea why it is doing it to the comments. Let me try something else for you : P!!!
in loop.php
try
<?php while (have posts()): the_post(); ?>
change to
<?php while $x=0; (have posts()): the_post(); ?>
Then add this
<?php if ($odd = $x%2){?>
<div style=”background-color:#404040;padding:10px 0px 10px 10px;”>
<?php }?>
change teh style to your liking.
close teh above with
<?php if( $odd = $x%2 ){?>
</div>
<?php }?>
finally close the while loop with
yours will look like
<?php endhile; ?>
replace with
<?php
$x++;
endwhile; ?>
Moderator
t-p
(@t-p)
nothing.
thanks chewbears for your patient and help.
Lots of this stuff is above my head. so I am going to give up.
However, after you are done working this out with Twenty Ten, please let’s know the link. thanks.
Least I solved the comment alternating color question I see on these boards LOL.
I am going to get twentyten up on my local and try out some things. I will get back if I get an answer.
t-p
FIXED!!!
I dl’d the theme and got it all working. If you need I can e-mail you the working php files.
go to loop.php
FIND:
<?php while ( have_posts() ) : the_post(); ?>
change to:
<?php $x=0; while ( have_posts() ) : the_post(); ?>
FIND:
<?php else : ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2 class="entry-title"><a>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
change to :
<?php else : ?>
<?php if ($odd = $x%2)
{ echo $odd;
echo "<div style='background-color: #f2f7fc'>";
}
else
echo "<div style='background-color: #ffffff'>";
?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2 class="entry-title"><a>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
</div>
Then change the background to the colors you want and BINGO!
Moderator
t-p
(@t-p)
Thanks so much for your continue help.
After making the two mods to the loop.php, I get this error message:
Parse error:
parse error, unexpected $ in /home/virtual/siteXXXXX/wp/wp-content/themes/mytwentyten/loop.php on line 218
And line 218 is the last line in loop.php:
<?php endif; ?>
oh gosh I forgot to post the last piece!
<?php
$x++;
endwhile; ?>
you have to close the loop
I don’t have my code in front of me anymore to see, but you have to close the while loop.
Moderator
t-p
(@t-p)
Thanks chewbears! Great work!
Appreciate your time and patient.
THis post has been resolved, even though I doubt the OP will tag iT : P