WordPress.org

Ready to get started?Download WordPress

Forums

Category Icons
[resolved] Category Icons Disappeared (22 posts)

  1. riversjm
    Member
    Posted 1 year ago #

    Hi there. Full disclosure-a friend built my website and I'm a computer moron. After the last plugin update my categories disappeared and in place was an error message reading 'fatal error: [] operator not supported for strings in' and then something about line 117 and categoryicons.php. The error message was a link that led to the first of the 8 categories that should be on the page. My friend who built the site was able to get all 8 categories to come back but not the icons, only text links. I don't know for sure it was the update, but it was working fine earlier that day and then not working immediately after. thanks.

    http://wordpress.org/extend/plugins/category-icons/

  2. submarine
    Member
    Plugin Author

    Posted 1 year ago #

    Hi.

    What if you try with the version 2.2.2 ?

  3. knit_hat
    Member
    Posted 1 year ago #

    I think I might be the friend this person is talking about. I updated the plugin and am still getting

    Fatal error: [] operator not supported for strings in /home/retros10/public_html/wp-content/plugins/category-icons/category_icons.php on line 123

    If I remove the [] from
    $p['cat'][] = $category->cat_ID;
    the page works but only has the text links

    URL: http://retrospectrentals.com/inventory/

  4. knit_hat
    Member
    Posted 1 year ago #

    If I put a number in the [], like 14, I can get 3 of the 8 icons to appear. if that helps at all...

  5. submarine
    Member
    Plugin Author

    Posted 1 year ago #

    Did you try the solution in this thread ?

  6. knit_hat
    Member
    Posted 1 year ago #

    the exact snippet you recommend to replace does not exist in that category_icons.php. This is what we have:

    stripslaghes_gpc_arr($p);
    if (is_category() && in_the_loop()) {
    $cat = (int) get_query_var('cat');
    $category=get_category($cat);
    if (!isset($p['cat'])) {
    $p['cat']=array();
    }
    /*elseif (!is_array($p['cat'])) {
    $p['cat']=array(0=>$p['cat']);
    }*/
    $p['cat'][] = $category->cat_ID;
    }

  7. knit_hat
    Member
    Posted 1 year ago #

    The instructions say to replace this block:
    if (is_category() && in_the_loop()) {
    $cat = (int) get_query_var('cat');
    $category=get_category($cat);
    $p['cat'][] = $category->cat_ID;
    }

    I don't see that block in the code

  8. knit_hat
    Member
    Posted 1 year ago #

    I added this:

    if (!isset($p['cat']) || !is_array($p['cat'])) {
    $p['cat']=array();
    }

    and then added back the [] to $p['cat'][] = $category->cat_ID;

    The page still doesn't display the icons but it no longer throws and error due to the [].

  9. submarine
    Member
    Plugin Author

    Posted 1 year ago #

    Could you give me the url of your site, please ?

  10. knit_hat
    Member
    Posted 1 year ago #

    sure! http://retrospectrentals.com/inventory/ is the page mentioned above that is affected.

  11. submarine
    Member
    Plugin Author

    Posted 1 year ago #

    Your theme is customized. Could you display the code that displays the html in the "cat contain" div, please ?

    <div class="catcontain">
    <ul>
    <li class="cat-item"><div class="catbox">...</div>
  12. knit_hat
    Member
    Posted 1 year ago #

    <div class="catcontain">

    </div>

  13. submarine
    Member
    Plugin Author

    Posted 1 year ago #

    It's working. Here is what I've done :

    <div class="catcontain">
    <?php
        if (function_exists('get_cat_icon')) {
            foreach( get_categories('orderby=name&order=ASC&child_of=6') as $category) {
                echo '<li class="cat-item">';
                echo '<div class="catbox">';
                echo get_cat_icon("echo=false&link=false&cat=".$category->cat_ID).' '.$category->cat_name.' ('.$category->category_count.')';
                echo '</div>';
            }
        }
    ?>
    </div>
  14. knit_hat
    Member
    Posted 1 year ago #

    I gave this a shot and it's still not showing the icons

  15. submarine
    Member
    Plugin Author

    Posted 1 year ago #

    This is weird. Can you modify your wp-config.php in order to display error ? Luckily this will show you if there is an error somewhere...

    define('WP_DEBUG', true);

    I'm willing to help you if you give me a temporary access to your blog. You can mail me using this form.

  16. knit_hat
    Member
    Posted 1 year ago #

    I don't have access to the wp-config file right now. I'm asking the site owner if she would mind granting you access.

  17. knit_hat
    Member
    Posted 1 year ago #

    I just filled out your form.... thanks again!

  18. submarine
    Member
    Plugin Author

    Posted 1 year ago #

    OK, I've resolved your issue, you can remove my access now. In the next release, I'll revert to the default behavior in the category page. I'll add an option to activate if the user want the same icon in the category page or not. I didn't think that'd bring issues like these... :(

    This is the same thing as this thread.

    I removed this part :

    if (is_category() && in_the_loop()) {
    		$cat = (int) get_query_var('cat');
    		$category=get_category($cat);
    		if (!isset($p['cat']) || !is_array($p['cat'])) {
        		$p['cat']=array();
    		}
    
        	$p['cat'][] = $category->cat_ID;
    	}
    	else {

    and the corresponding curly braket : }, just before :

    $nb_icons = 0;
  19. knit_hat
    Member
    Posted 1 year ago #

    To anyone else reading this thread...I just want to give a shout-out and thanks to the author of this plug-in for helping us resolve this issue personally.

    Thanks so much for standing behind your creation and taking the time to help us out. We'll buy you a beer if you're ever in Richmond, VA.

    Thanks again!

  20. submarine
    Member
    Plugin Author

    Posted 1 year ago #

    You're welcome, and if you're willing to buy me something, why not go for a coffee ? ;-)

  21. riversjm
    Member
    Posted 1 year ago #

    Done. Thank you!! knit_hat gets beers.

  22. submarine
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks to YOU, guys ! :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.