I'm trying to define a new shortcode in WordPress, and I get the following error when the function is loaded (just loaded, I haven't tried to call it anywhere yet):
Parse error: syntax error, unexpected T_STRING in /pathtomytheme/user_functions.php on line 105
Here's the code; line 105 is "$cat_n = count($cats) – 1;":
function usertag_2colcats($atts) {
extract(shortcode_atts(array('parent' => 0,'depth' => 2,), $atts));
$cats = explode('<br />', wp_list_categories('title_li=&echo=0&depth=' . $depth . '&style=none&show_count=1&use_desc_for_title=0&child_of=' . $parent));
$cat_n = count($cats) – 1;
for ($i = 0; $i < $cat_n; $i++) {
if ($i < $cat_n/2) $cat_left = $cat_left . '<li>' . $cats[$i] . '</li>';
elseif ($i >= $cat_n/2) $cat_right = $cat_right.'<li>'.$cats[$i].'</li>';
}
echo '<ul class="leftcats">' . $cat_left . '</ul><ul class="rightcats">' . $cat_right . '</ul>';
}
If I change that line so that it doesn't use the count function, e.g. to "$cat_n = 5;", the function loads without error. It seems like I'm missing something really obvious; what is it?
The original code is here: http://pcsplace.com/blog-tips/how-to-split-categories-list-into-columns-in-wordpress/