• Ah these things are taking up too much room on my blogs. I finally haave decided I want to say goodbye to them

    How do I do it?

    Thanks

Viewing 15 replies - 1 through 15 (of 18 total)
  • Is there any chance you can post the blog url?

    Thread Starter markey101101

    (@markey101101)

    It’s not necessary to post the blog URL.

    This happens with all WordPress blogs.

    I’ve even removed the code in theme functions that could be the only piece of code that outputs those and it made no difference.

    Thing is, at the moment, I don’t know about the tag_item thingies. If I see the website, I’ll most certainly be able to see where they are and then try it in my own blog and help out.

    I’m a visual guy hehe. I need visuals to help.

    Thread Starter markey101101

    (@markey101101)

    Jimmy unfortunately I am not obliged to post the URL as it is a clients site.

    Regards

    Absolutely fine, sorry for your time 🙂

    I had same problem once. “I NEED HELP BUT I CANT POST URL *grits teeth*”.

    Wish you best of luck.

    Moderator keesiemeijer

    (@keesiemeijer)

    I didn’t test this. just some old code i changed a bit to make it presentable

    $categories =  get_categories();
    $current_category = get_query_var('cat');
    foreach ($categories as $cat) {
    	$catname = get_cat_name($cat->cat_ID);
    		if ($current_category == $cat->cat_ID) {
    				echo "<li class=\"selected\">".$catname."</li>\n";
    		} else {
    				echo "<li><a href=\"" . get_category_link($cat->cat_ID) . "\">" . $catname . "</a></li>\n";
    		}
    }

    just check out get_categories()

    It’s not necessary to post the blog URL.

    Really? Then why bother posting here at all? How can you expect people to offer effective help if they can’t see the problem? A comment like:

    these things are taking up too much room on my blogs

    doesn’t even come close to explaining what your problem is. CSS classes take up exactly zero estate on the final pages, so how can they be “taking up too much room”?

    This happens with all WordPress blogs.

    Well it’s the first time I’ve heard of this particular “problem”, so it can’t be that common.

    If you want people to help you (and bear in mind that all help here is free and voluntary), you need to work with them – not against them.

    Moderator keesiemeijer

    (@keesiemeijer)

    Now I tested it and it does work. Just wrap it up in a <ul>

    Thread Starter markey101101

    (@markey101101)

    @esmi

    The reason is because

    These

    <li class=”cat-item and <li class=”tag_item”

    Are added as standard with every WordPress install so there is really no need to post the URL.

    If there was a need I would have to post it but in this case I don’t and it’s a clients site which is only new which would cause this post to rank for the clients site name before his site even ranks.

    I also do want to know how to do it for furute projects not just this one.

    They arent’ even necessary which is my biggest issue with them.

    As for your reply you are a moderator so surely your reply should be on topic instead of a rant because that’s what it looks like to me when if you took a minute to take a deep breath you’d know exactly why the url doesn’t need to be posted.

    I know if I was moderator there is no way I would have replied like you just did.

    Those classes are not added as standard on every WP install. It depends upon your theme and what functions and/or template tags it uses. Now can you understand why it’s important to be able to view the site?

    As for post rankings, you can always use a url-shortening service to disguise the final location.

    And I consider that my remarks were on-topic. A reasonable request was made by someone who was trying to help you. Your response was both incorrect and unduly curt.

    Thread Starter markey101101

    (@markey101101)

    Ok thanks for that but it’ still not going to help by posting the URl because you won’t be able to access the themefucntions.php file.

    So I have it here. The parts that count.

    Categories

    # Displays a list of categories
    function dp_list_categories($num=0, $exclude=”) {
    if (strlen($exclude)>0) $exclude = ‘&exclude=’ . $exclude;
    $categories = get_categories(‘hide_empty=1’.$exclude);
    $first = true; $count = 0;
    foreach ($categories as $category) {
    if ($num>0) { $count++; if ($count>$num) break; } // limit
    if ($category->parent<1) {
    if ($first) { $first = false; $f = ‘ class=”f”‘; } else { $f = ”; }
    ?>

    Tags

    There is nothing for the tags in my Theme functions.

    Brings me back to my first point – it’s not the theme that is adding the tags but it is WordPress itself.

    But I don’t know how or where.

    So I’m still right even though I’m being told I’m not.

    I don’t want to argue just to find the answer that’s all.

    get_categories() doesn’t add any markup or CSS classes. It just returns an array of category objects:

    [term_id] => 45
    [name] => A Parent
    [slug] => parent
    [term_group] => 0
    [term_taxonomy_id] => 46
    [taxonomy] => category
    [description] =>
    [parent] => 0
    [count] => 1
    [cat_ID] => 45
    [category_count] => 1
    [category_description] =>
    [cat_name] => A Parent
    [category_nicename] => parent
    [category_parent] => 0

    So I can only assume that it’s the missing lines in your code that are adding the classes. Can you try posting the code inside backticks so that it won’t be parsed by the forum software? Or drop it into the WordPress pastebin and post the pastebin url here?

    Moderator keesiemeijer

    (@keesiemeijer)

    For tags you coul’d try this

    <ul>
    <?php
    	$tags = get_tags();
    	foreach ($tags as $tag) {
    		echo "<li><a href=\"" . get_tag_link($tag->term_id) . "\">" . $tag->name . "</a></li>\n";
    	}
    ?>
    </ul>
    Moderator keesiemeijer

    (@keesiemeijer)

    please explain what you want to do with the function dp_list_categories

    Moderator keesiemeijer

    (@keesiemeijer)

    Maybe this is what you want (not shure)

    function dp_list_categories($num=0, $exclude = '') {
    	if (!empty($exclude)) {
    		$exclude = '&exclude=' . $exclude;
    	}
    	$categories = get_categories('hide_empty=1'.$exclude .'&number='.$num);
    	$html = '';
    	$html .= '<ul>' . "\n";
    	foreach ($categories as $cat) {
    			if($cat->category_parent == 0) {
    			$html .= '<li class="f"><a href="' . get_category_link($cat->cat_ID) . '">';
    			$html .= $cat->cat_name . '</a></li>' . "\n";
    			$childcategories =  get_categories('child_of='.$cat->cat_ID.'');
      	  	if(!empty($childcategories)){
    	  			foreach ($childcategories as $ccat) {
    	  			$html .= '<li><a href="' . get_category_link($ccat->cat_ID) . '">';
    					$html .= $ccat->cat_name . '</a></li>' . "\n";
    					}
      	  	}
    			}
    	}
    	$html .= '</ul>' . "\n";
    	return $html;
    }

    you can call it by putting this somewhere in your theme:
    <?php echo dp_list_categories(0, '3,13'); ?>

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Remove <li class=”cat-item and <li class=”tag_item”’ is closed to new replies.