• Hey there,

    I was wondering if it’s possible to have a list style that alternates between list items and is compatible with the widgets plugin.

    If so, how is it done?

    An example of such would be:

    <h2>Sidebar List</h2>
        <ul>
    	<li class="">Item One</li>
    	<li class="alt">Item Two</li>
    	<li class="">Item Three</li>
    	<li class="alt">Item Four</li>
    	<li class="">Item Five</li>
        </ul>

    Is it possible for widgets to have an output similar to the above?

Viewing 1 replies (of 1 total)
  • Thread Starter nixwanning

    (@nixwanning)

    I’ve found a way to list it out like that via php.

    $thecategories = get_categories('orderby=name');
    
    	$cat_alt = 'norm';
    
    	foreach ($thecategories as $onecategory) {
    
    		echo '<li class="' .$cat_alt. '"><a href="' .get_bloginfo('url'). '/?cat=' . $onecategory->cat_ID . '" title="' . $onecategory->cat_name . '">' . $onecategory->cat_name . '</a>';
    
    		if ($cat_alt == 'norm') {
    			$cat_alt = 'alt';
    		} else {
    			$cat_alt = 'norm';
    		}
    	}

    Which will involve building new widgets out of the old ones. Would anyone know of an easier way to alternate styles between list elements or is this the only possible way?

Viewing 1 replies (of 1 total)
  • The topic ‘Widgets – Alternating List Styles’ is closed to new replies.