WordPress.org

Ready to get started?Download WordPress

Forums

Category Icon Plugin (25 posts)

  1. chrisc
    Member
    Posted 10 years ago #

  2. Anonymous
    Unregistered
    Posted 10 years ago #

    OK, I feel dumb. I'm a newbie to WordPress, so maybe it's normal...
    I have a WordPress 1.2 setup.
    I installed the CategoryIcon Plugin in the right directory, after the needed changes.
    It appeared in the plugins list. I activated it.
    It is the only plugin activated.
    I have only 2 icons ready for the 6 categories. They are following the syntax of the original category name, plus the extension, all in the correct dedicated directory.
    Nothing show on the blog.
    Do I need to add a tag in the template?
    Thanks Nico

  3. Anonymous
    Unregistered
    Posted 10 years ago #

    The plug-in is working for me except that when it is enabled I am unable to login when I try I get the following errors
    Warning: Cannot modify header information - headers already sent by (output started at /home/polargee/public_html/wp-content/plugins/cat-icon.php:69) in /home/polargee/public_html/wp-login.php on line 257
    Warning: Cannot modify header information - headers already sent by (output started at /home/polargee/public_html/wp-content/plugins/cat-icon.php:69) in /home/polargee/public_html/wp-login.php on line 258
    Warning: Cannot modify header information - headers already sent by (output started at /home/polargee/public_html/wp-content/plugins/cat-icon.php:69) in /home/polargee/public_html/wp-login.php on line 259
    Warning: Cannot modify header information - headers already sent by (output started at /home/polargee/public_html/wp-content/plugins/cat-icon.php:69) in /home/polargee/public_html/wp-login.php on line 260
    Warning: Cannot modify header information - headers already sent by (output started at /home/polargee/public_html/wp-content/plugins/cat-icon.php:69) in /home/polargee/public_html/wp-login.php on line 261
    any ideas

  4. cube
    Member
    Posted 10 years ago #

    I've the same Problem like "camelreef"! I have also the Plugin from 'Chris Cosentino' and nothing is shown on my page! I think it's because of the absolut path /*  absolute system path to your icon directory, include trailing slash */
    $icon_path = "/v4/weblog/wp-category-icons/";

    I have also tried the absolut path $icon_path = "/home/2btixw2/htdocs/v4/weblog/wp-category-icons/"; wich I have copyed from my old MT-Weblog Admin screen.
    How can i check what's the Problem with this plugin?

  5. Anonymous
    Unregistered
    Posted 10 years ago #

    The $icon_path should have the absolute system path of your icon directory .. just go to your icon directory and issue 'pwd' command and it will show you the absolute path. The $icon_url should points to path from your home directory .. and in your case ..
    $icon_path = "/home/2btixw2/htdocs/v4/weblog/wp-category-icons/"
    $icon_url = "/htdocs/v4/weblog/wp-category-icons/"
    Good luck!

  6. ShelbyYY
    Member
    Posted 10 years ago #

    Anonymous: Hi. :)
    When you get errors like "Warning: Cannot modify header information..." it's because you have something in the code which sends out for information at the very outset - i.e., before your server continues parsing the rest of the page, but you're trying to add another thing that needs to send information at the very outset. It's possible to send it all at once, and get everything you need taken care of. :)
    In my case, for example, there are several things which send out for info at the outset. The problem is, you can't have one request end, and another try to begin. It will only send out one time at the very outset, and then it continues with the rest of the page. So, if you have multiple things that need to get information from the very beginning, you need to sort of put them all in one call! :)
    The very beginning of my index.php template, for example looks like this:
    '<?php
    require_once('wp-blog-header.php');
    include('cookiecheck.php');
    wp_head();
    ?>'
    What that means, in plain terms, is that I have the wp-blog-header.php being sent from the very outset, also, cookiecheck.php - which is for skinning the site, and then the wp_head function call. LOL. So, if a plugin told me that I had to add '<?php function_call(); ?>' at the very beginning of the document, instead of doing that, I would have to simply take the 'function_call();' part of it, and put that inside what I already have. For example:
    '<?php
    require_once('wp-blog-header.php');
    include('cookiecheck.php');
    wp_head();
    function_call();
    ?>'
    Hopefully that makes sense. :) Maybe someone else would be better at explaining that than I am.

  7. MattRead
    Member
    Posted 10 years ago #

    I'm getting this warning evertime I try to login to my WP. I have to disable this plugin then I can login again. I also get similar warnings when I try to edit a post, write a post, change options, and when someone posts comments. I think the Plugin has a BUG. As I say I only get the warnings when this plugin is enabled. I have tried disabling all others too.
    Warning: Cannot modify header information - headers already sent by (output started at /home/mayhemma/public_html/blog/wp-content/plugins/cat-icon.php:1) in /home/mayhemma/public_html/blog/wp-login.php on line 257
    Warning: Cannot modify header information - headers already sent by (output started at /home/mayhemma/public_html/blog/wp-content/plugins/cat-icon.php:1) in /home/mayhemma/public_html/blog/wp-login.php on line 258
    Warning: Cannot modify header information - headers already sent by (output started at /home/mayhemma/public_html/blog/wp-content/plugins/cat-icon.php:1) in /home/mayhemma/public_html/blog/wp-login.php on line 259
    Warning: Cannot modify header information - headers already sent by (output started at /home/mayhemma/public_html/blog/wp-content/plugins/cat-icon.php:1) in /home/mayhemma/public_html/blog/wp-login.php on line 260
    Warning: Cannot modify header information - headers already sent by (output started at /home/mayhemma/public_html/blog/wp-content/plugins/cat-icon.php:1) in /home/mayhemma/public_html/blog/wp-login.php on line 261

  8. carthik
    Member
    Posted 10 years ago #

    Mattread, someone has posted the same problem, and received a reply above. Does the suggested solution above work?

  9. carthik
    Member
    Posted 10 years ago #

  10. Anonymous
    Unregistered
    Posted 9 years ago #

    Hello. I from Russia and, logically, in names of categories use cyrillics. Taking into account, that in WordPress is used unicode in a database at creation of pictures for categories with names cyrillics the plug-in "does not see" them. I have solved this problem rather simply:
    'function icon_picker($text)
    {
    global $icon_path, $icon_url, $icon_align, $icon_ext, $icon_cat;
    $content = '';
    $cat_names = array();
    $cat_ids = array();
    $cats = get_the_category('');
    foreach ($cats as $category)
    {
    $cat_names[] = stripslashes($category->cat_name);
    $cat_ids[] = $category->category_id;
    }
    if($icon_cat == "first")
    {
    $cat_to_use = $cat_names[0];
    $cat_id = $cat_ids[0];
    } else {
    $size = sizeof($cat_names);
    $cat_to_use = $cat_names[$size - 1];
    $cat_id = $cat_ids[$size - 1];
    }
    if(file_exists($icon_path . $cat_id . $icon_ext))
    {
    $filename = $icon_url . $cat_id . $icon_ext;
    $content .= "<img class='caticon' src='" . $icon_dir . $filename . "'";
    $content .= " align='" . $icon_align;
    $content .= "' alt='" . $cat_to_use . " Icon' />\n";
    $text = $content . $text;
    }
    return $text;
    }'
    That is I use not the name of a category, and it ID. It is not so convenient, as it is necessary to look through a database for search id for a category. Can be there is other, more convenient decision?

  11. mcothier
    Member
    Posted 9 years ago #

    I am having problems because one of my cats is named "blah/blah" and I can't name an image blah/blah.jpg. Is there any way to make it so that image name is the cat id instead?

  12. Have you tried the Category Image(s) plugin? If your category was named "blah/blah", the associated image name would be "blahblah.jpg" (or .gif, or .png).

  13. ahumado
    Member
    Posted 9 years ago #

    If you want to have a default icon that shows for all categories that don't have a specific icon, put this else in:

    else {
    $filename = $icon_url . "General" . $icon_ext;
    $content .= "<img class='caticon' src='" . $icon_dir . $filename . "'";
    $content .= " align='" . $icon_align;
    $content .= "' alt='" . $cat_to_use . " Icon' />\n";
    $text = $content . $text;
    }

    between $text = $content . $text;
    }

    and
    return $text;
    in the original code.
    Replace the word General with the category icon you want to use.

    so the final if looks like this:

    if(file_exists($icon_path . $cat_to_use . $icon_ext))
    {
    $filename = $icon_url . $cat_to_use . $icon_ext;
    $content .= "<img class='caticon' src='" . $icon_dir . $filename . "'";
    $content .= " align='" . $icon_align;
    $content .= "' alt='" . $cat_to_use . " Icon' />\n";
    $text = $content . $text;
    } else {
    $filename = $icon_url . "General" . $icon_ext;
    $content .= "<img class='caticon' src='" . $icon_dir . $filename . "'";
    $content .= " align='" . $icon_align;
    $content .= "' alt='" . $cat_to_use . " Icon' />\n";
    $text = $content . $text;
    }
    return $text;

  14. lokrin
    Member
    Posted 9 years ago #

    Ok, I've got the plugin up and running and it works fine. However, the icon is at the bottom of the post by the comment link. There, it almost looks like it belongs to the following post and is a bit confusing. I would prefer it at the top of the post near the category listings for the post. Is there somewhere I can change this?

  15. lokrin
    Member
    Posted 9 years ago #

    I also made a slight change in two lines above. They are the same line twice:

    $content .= "' alt='" . $cat_to_use . " Icon' />n";

    I like a tooltip when I hover over the icon:

    $content .= "' alt='" . $cat_to_use . " Icon' title='Filed Under " . $cat_to_use ."' />n";

  16. lokrin
    Member
    Posted 9 years ago #

    Got it! At the very bottom I changed

    add_filter ( 'the_content', 'icon_picker' );

    to

    add_filter ( 'the_category', 'icon_picker' );

  17. tverbeek
    Member
    Posted 9 years ago #

    I wanted this to display icons for all of the categories an entry belongs to, so I added a clause that simply loops through them, when the value of $icon_cat = "all". (I also wanted the icons to link to the appropriate category "page"; which is a hack that won't necessarily port to other sites' configurations, so that's left as an exercise for the reader. {smile})


    function icon_picker($text)
    {
    global $icon_path, $icon_url, $icon_align, $icon_ext, $icon_cat;
    $content = '';
    $cat_names = array();
    $cats = get_the_category('');
    if($icon_cat == "all")
    {
    foreach($cats as $category)
    {
    $cat_to_use = stripslashes($category->cat_name);
    if(file_exists($icon_path . $cat_to_use . $icon_ext))
    {
    $filename = $icon_url . $cat_to_use . $icon_ext;
    $content .= "<img class='caticon' src='" . $icon_dir . $filename . "'";
    $content .= " align='" . $icon_align;
    $content .= "' alt='" . $cat_to_use . " icon' hspace='5' />n";
    }
    }
    $text = $content . $text;
    } else {
    foreach ($cats as $category)
    {
    $cat_names[] = stripslashes($category->cat_name);
    }
    if($icon_cat == "first")
    {
    $cat_to_use = $cat_names[0];
    } else {
    $size = sizeof($cat_names);
    $cat_to_use = $cat_names[$size - 1];
    }
    if(file_exists($icon_path . $cat_to_use . $icon_ext))
    {
    $filename = $icon_url . $cat_to_use . $icon_ext;
    $content .= "<img class='caticon' src='" . $icon_dir . $filename . "'";
    $content .= " align='" . $icon_align;
    $content .= "' alt='" . $cat_to_use . " Icon' />n";
    $text = $content . $text;
    }
    }
    return $text;
    }

  18. antonskey
    Member
    Posted 9 years ago #

    if anyone (especially you tverbeek) could help me with linking the image to the category, that would be amazing. I'm trying to use WP as a CMS for my site, so I'm getting the posts and categories to work the way I'd like before changing the theme, and I've got the image to appear (hopefully it will always display the image I want), but I'd like it to link to that category. I know NOTHING about PHP so any help would be greatly appreciated.

  19. antonskey
    Member
    Posted 9 years ago #

    oh, if you want to see what i've got so far, go to http://www.antonskey.com/punkcanada/wordpress

  20. mattybinks
    Member
    Posted 9 years ago #

    does anyone know if this works for version 1.5.1.2?
    thanks!

  21. Jinsan
    Member
    Posted 9 years ago #

    I HIGHLY suggest using the following plugin:

    http://www.coffee2code.com/wp-plugins/#categoryimages

    Easy to install, to use and oh so nice. Links back to the category too ;)

  22. feverinlove
    Member
    Posted 8 years ago #

    The plugin was working perfectly before I wanted to use permalinks
    My category url is: http://www.turbofsi.net/audi/
    but the category icon is linked to : http://www.turbofsi.net/category
    ??

  23. feverinlove
    Member
    Posted 8 years ago #

    bump

  24. Bunglegirl
    Member
    Posted 8 years ago #

    Is this plugin still being supported? The developer's site is down as far as I can tell. I have tried using 'category images' instead, but I want the image to show up in the post as well as in the sidebar. As far as I can tell 'category images' can't do the sidebar.

  25. buskerdog
    Member
    Posted 8 years ago #

    I'm trying to use this but the screen that should allow me to upload icon files just has a pull down menu that says ---no icon--- and no upload options. I've left the local, URL, and filetypes fields blank in the options screen and I've tried filling them in. Nothing works.

    When I view source for the page that should be allowing me to upload the icons I see this hidden away:

    <b>Fatal error</b>: Call to a member function on a non-object in <b>/home/sandarac/public_html/wp/wp-content/plugins/category_icons.php</b> on line <b>322</b>

    What's happening here?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.