2 personman Jun 02, 2006 02:15
![](https://forums.b2evolution.net/media/users/personman/profile_pictures/.evocache/3227909422ccf42e09de.jpg/crop-top-80x80.jpg?mtime=1372015408)
Nope, that cuts off the whole Category list and everything that follows it :)
New...
/**
* callback to display sublist element
*/
function cat_list_before_each( $cat_ID, $level )
{ // callback to display sublist element
global $blogfilename, $cat_array, $cat_line_start, $cat_line_checkbox;
$cat = get_the_category_by_ID( $cat_ID );
if( in_array( $cat_ID, $cat_array ) )
{ // This category is in the current selection
echo '<li class="currentCat">';
} else {
echo '<li>';
}
if( $cat_line_checkbox )
{
echo '<label><input type="checkbox" name="catsel[]" value="'.$cat_ID.'"';
if( in_array( $cat_ID, $cat_array ) )
{ // This category is in the current selection
echo ' checked="checked"';
}
echo ' />';
}
echo '<a href="'.url_add_param( get_bloginfo('blogurl'), 'cat='.$cat_ID ).'">'.format_to_output($cat['cat_name'], 'htmlbody').'</a>';
if( in_array( $cat_ID, $cat_array ) )
{ // This category is in the current selection
echo " *";
}
Original...
/**
* callback to display sublist element
*/
function cat_list_before_each( $cat_ID, $level )
{ // callback to display sublist element
global $blogfilename, $cat_array, $cat_line_start, $cat_line_checkbox;
$cat = get_the_category_by_ID( $cat_ID );
echo $cat_line_start;
if( $cat_line_checkbox )
{
echo '<label><input type="checkbox" name="catsel[]" value="'.$cat_ID.'"';
if( in_array( $cat_ID, $cat_array ) )
{ // This category is in the current selection
echo ' checked="checked"';
}
echo ' />';
}
echo '<a href="'.url_add_param( get_bloginfo('blogurl'), 'cat='.$cat_ID ).'">'.format_to_output($cat['cat_name'], 'htmlbody').'</a>';
if( in_array( $cat_ID, $cat_array ) )
{ // This category is in the current selection
echo " *";
}
Fixed... just a missing '
echo '<li class="currentCat">;
echo '<li class="currentCat">';
Oops, sorry for the typo.
personman.
Is there any way this can be adapted to the Categories Plugin in 1.8?
I'm playing with it, with no success to date and simply need to know if I should stop banging around in that plugin :(
John, it can be done, but you'll need to edit the /plugins/_categories.plugin.php file. That will affect all of your blogs, but for this it probably wouldn't be a bad thing. (If it were, you could make a second category plugin and call that on the skins where you want it.)
This is the section you need to change:
function callback_before_each( $cat_ID, $level )
{ // callback to display sublist element
global $tab, $blog, $cat_array;
$cat = get_the_category_by_ID( $cat_ID );
$r = $this->params['line_start'];
if( $this->params['form'] ) {
// We want to add form fields:
I haven't tested this, but it should give you the currentCat class:
function callback_before_each( $cat_ID, $level )
{ // callback to display sublist element
global $tab, $blog, $cat_array;
$cat = get_the_category_by_ID( $cat_ID );
if( in_array( $cat_ID, $cat_array ) )
{
$r = '<li class="currentCat">';
} else {
$r = $this->params['line_start'];
}
if( $this->params['form'] ) {
// We want to add form fields:
Thanks Danny
I like the idea of the second plugin... nice bit of lateral thinking for an issue I couldn't get my head around
Cheers mate
Works fine Danny.
This isn't tested, but I think it should work. Go up a few lines from there and find:
Replace it with