• I have specified class: <li class=”list-bullets”>

    I’ve updated all of my links in the sidebar to reflect this class. However, I can’t seem to find where to update the list_cats and the <?php wp_get_archives….they’re still using just a regular bullet.

    I’m using:

    <?php wp_get_archives(‘type=monthly’); ?>
    and
    <?php list_cats(0, ”, ‘name’, ‘asc’, ”, 1, 0, 1, 1, 1, 1, 0,”,”,”,”,”) ?>

    any help?

Viewing 9 replies - 1 through 9 (of 9 total)
  • you cant do that unless you want to edit a core file as the template tag list_cats doesnt come with the option to edit the before and after string.

    If you want to edit the core file, then just like all other functions in wordpress you can either use grep/wingrep to locate the function and edit it, or you can use google to locate one of the many phpxref sites that tell you where those functions are defined.

    wingrep:

    http://www.wingrep.com

    phpxref:

    http://www.google.com/search?hl=en&safe=off&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=phpxref+wordpress&spell=1

    Thread Starter mojolocollc

    (@mojolocollc)

    there has to be a way to control that somewhere. I’m looking at <?php $categories = get_categories(parameters); ?>

    That displays the list using my css class….BUT it adds a “category” heading to the list, which i don’t need. I don’t see a way to remove this….

    getting closer, i think….

    there has to be a way to control that somewhere

    You know, sometimes I feel like new posters think we pull this stuff out of nowhere.

    I will refer you, therefore to this:

    http://codex.wordpress.org/Template_Tags/list_cats

    You cannot change the output of list_cats by editing that template_tag. Just because it can be done with one template tag does not mean it can be done with another.

    You did not ask about there being another template tag that might do you want, and frankly, since I can tell you didnt read the codex before posting this thread,I wasnt going to offer it.

    http://codex.wordpress.org/Template_Tags/wp_list_categories

    Use that if you want to tack crap onto the <li>

    Thread Starter mojolocollc

    (@mojolocollc)

    Ok, maybe I’m not being clear in my question-

    When I view the source of the page in my browser, it shows:

    <li class=”cat-item cat-item-4″>Category Name (2)

    My question is where is it getting the class=cat-item cat-item 4? It’s not in my style sheet, and it’s not on the template. Manipulating the code in deprecated.php doesn’t really help.

    So, obviously, the script is generating this from SOMEWHERE…..if I knew where, I could change it. I just don’t know where to find it. And, the documentation on it is a little fuzzy.

    Does that help at all?

    thats because you are using list_cats, as you indicate above.

    Now, you wouldnt know this, right off, so I will grant you that.

    I know it because Ive been using WP longer than God. OK, not quite, but almost.

    Tell me what you want to do with that, and I will tell you how to do it? And understand, that if you are unwilling to use another template tag, you will have to edit a core file.

    better yet, I have to go to work, so Ill just tell you.

    function start_el($output, $category, $depth, $args) {
    		extract($args);
    
    		$cat_name = attribute_escape( $category->name);
    		$cat_name = apply_filters( 'list_cats', $cat_name, $category );
    		$link = '<a href="' . get_category_link( $category->term_id ) . '" ';
    		if ( $use_desc_for_title == 0 || empty($category->description) )
    			$link .= 'title="' . sprintf(__( 'View all posts filed under %s' ), $cat_name) . '"';
    		else
    			$link .= 'title="' . attribute_escape( apply_filters( 'category_description', $category->description, $category )) . '"';
    		$link .= '>';
    		$link .= $cat_name . '</a>';
    
    		if ( (! empty($feed_image)) || (! empty($feed)) ) {
    			$link .= ' ';
    
    			if ( empty($feed_image) )
    				$link .= '(';
    
    			$link .= '<a href="' . get_category_rss_link( 0, $category->term_id, $category->slug ) . '"';
    
    			if ( empty($feed) )
    				$alt = ' alt="' . sprintf(__( 'Feed for all posts filed under %s' ), $cat_name ) . '"';
    			else {
    				$title = ' title="' . $feed . '"';
    				$alt = ' alt="' . $feed . '"';
    				$name = $feed;
    				$link .= $title;
    			}
    
    			$link .= '>';
    
    			if ( empty($feed_image) )
    				$link .= $name;
    			else
    				$link .= "<img src='$feed_image'$alt$title" . ' />';
    			$link .= '</a>';
    			if ( empty($feed_image) )
    				$link .= ')';
    		}
    
    		if ( isset($show_count) && $show_count )
    			$link .= ' (' . intval($category->count) . ')';
    
    		if ( isset($show_date) && $show_date ) {
    			$link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
    		}
    
    		if ( $current_category )
    			$_current_category = get_category( $current_category );
    
    		if ( 'list' == $args['style'] ) {
    			$output .= "\t<li";
    			$class = 'cat-item cat-item-'.$category->term_id;
    			if ( $current_category && ($category->term_id == $current_category) )
    				$class .=  ' current-cat';
    			elseif ( $_current_category && ($category->term_id == $_current_category->parent) )
    				$class .=  ' current-cat-parent';
    			$output .=  ' class="'.$class.'"';
    			$output .= ">$link\n";
    		} else {
    			$output .= "\t$link<br />\n";
    		}
    
    		return $output;
    	}

    Its inside classes.php. do what you will.

    And for the record, had you taken my advice, and went and downloaded wingrep you could have searched the files for ‘cat-item’ and found this without any help.

    Thread Starter mojolocollc

    (@mojolocollc)

    Yes, that’s it…..perfect. Thank you.
    I’ve been using WP for about 24 hours, so the learning is slight…but not terrible.

    Is there a similar function for get_archives? I don’t see it in classes.php.

    USE the codex. at the bottom of all the template tag pages are similar ones.

    http://codex.wordpress.org/Template_Tags/get_archives

    Thread Starter mojolocollc

    (@mojolocollc)

    already found it….thanks for your help. resolved.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘changing the bullet in the <?php list_cats… tag’ is closed to new replies.