adsense

WordPress: How to Alternate Row Colors





1. Open the 'header.php' file of your WordPress theme and look for '
' between your
and
tags. Add this code above the wp_head() function:
If your theme includes a
tag referencing the jQuery library, remove the entire
tag. WordPress comes with jQuery already installed.
2. Find the
and
tags between your
tags. This set of
tags does not include the 'src' attribute because it contains code embedded into the 'header.php' file. If your theme does not have these tags, add them. Add this code between the
tags like this:
jQuery(document).ready(function() {jQuery('.alternate:even tr').addClass('alt');});
Every other
tag in a table with a class name of 'alternate' gets the 'alt' class name. You can switch 'even' to 'odd' if desired.

3. Open the 'style.css' file of your WordPress theme and add this CSS code:.alternate .alt {background: color;}Change 'color' to the name of a color or its hexadecimal value. This CSS code sets a background color to every tag with a class name of 'alt' if that tag is nested within another tag given a class name of 'alternate.'

Comments

0 Responses to "WordPress: How to Alternate Row Colors"

Post a Comment

Popular Posts

About