• Resolved kramz

    (@kramz)


    Under my theme options I made a checkbox list of all my categories so that users can check to exclude from the header menu. It seems to work. However, when I don’t have any of them checked I get this warning on every page:
    Warning: implode() [function.implode]: Invalid arguments passed in /home/kramz/public_html/blog/wp-content/themes/blognfolio/header.php on line 38

    Warning: implode() [function.implode]: Invalid arguments passed in /home/kramz/public_html/blog/wp-content/themes/blognfolio/header.php on line 43
    my code on line 38 looks like this:
    $exclude = implode (",".$bnf_exc_cat);

    line 43
    $excludep = implode (",".$bnf_exc_pages);

    Any tips?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Well you need a comma, not a period, in that implode:
    $exclude = implode (",",$bnf_exc_cat);

    so don’t know if you need this, but just in case:

    if ($bnf_exc_cat) {
    $exclude = implode (",",$bnf_exc_cat);
    }
    Thread Starter kramz

    (@kramz)

    Hey MichaelH, thanks for your quick reply.

    I don’t know why I posted it with a period, I do have it with a comma.
    It looks just like your example and the warning still shows up.
    I’ve been trying to find what seems to be the problem and it looks like it shows up only when the options are empty. Every time I check a category it gets excluded with no problem from the header. But, as soon as I uncheck them the warning shows up.

    How can I fix this?

    Thread Starter kramz

    (@kramz)

    Anyone?

    Thread Starter kramz

    (@kramz)

    Finally solved it! in case you’re wondering this is what I did.

    $categorias = $bnf_exc_cat;
    	if ($categorias){
    		$categorias_exc= implode(",",$categorias);
    	} else {
    		$categorias_exc="";
    	}

    I assume this was because it was attempting to implode ‘nothing’.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘please help with Warning: implode()’ is closed to new replies.