1 john Jun 02, 2006 00:13
3 john Jun 02, 2006 02:45
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 " *";
}
4 john Jun 02, 2006 03:21
Fixed... just a missing '
echo '<li class="currentCat">;
echo '<li class="currentCat">';
5 personman Jun 02, 2006 05:54
Oops, sorry for the typo.
6 john Jul 20, 2006 02:26
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 :(
7 personman Jul 20, 2006 02:54
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:
8 john Jul 20, 2006 02:59
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
9 john Jul 20, 2006 10:51
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