Tag Sorting

Post Reply
User avatar
DarrenDriven
Master Bludit
Posts: 69
Joined: Thu Jan 07, 2016 9:39 am
Location: Portland OR
Contact:

Wow. I discovered NibbleBlog earlier this evening, installed it, loved it! But then... immediately discovered Bludit and tossed Nibble away for this much cleaner and newer project. I launched my new art blog on the 1st and decided to ditch Blogger and all that other crap for something I can customize and OWN THE CONTENT! Thank you!

I understand that this project is changing quickly and you probably already have these on your list, but here are a couple of changes that I think are necessary:
- Blog title should also be link to HOME. I don't have any pages on my site and it seems a little strange to have HOME as the only link under the Pages heading, and the title of the blog immediately above does nothing.
- Tags should either be arranged alphabetically or there should be some type of active sorting option for the admin or visitor

Thanks again for this awesome script! So easy to install and use!!!

Darren
http://idrewyourcar.com/
User avatar
DarrenDriven
Master Bludit
Posts: 69
Joined: Thu Jan 07, 2016 9:39 am
Location: Portland OR
Contact:

I switched to the Future Imperfect theme and that solved the title/link issue.

Also saw the feature-request forum area where this topic should reside. Please move me. :)
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

DarrenDriven wrote:I switched to the Future Imperfect theme and that solved the title/link issue.
Yes, this depends from the theme (but can manually be added).

But I think we should add this to the theme Pure.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

DarrenDriven wrote: - Tags should either be arranged alphabetically or there should be some type of active sorting option for the admin or visitor
You can sort the tags alphabetically by adding the function sort() to the file /plugins/tags/plugin.php (before line 38):

Code: Select all

sort($db);
foreach($db as $tagKey=>$fields)
{
	$count = $dbTags->countPostsByTag($tagKey);

	// Print the parent
	$html .= '<li><a href="'.HTML_PATH_ROOT.$filter.'/'.$tagKey.'">'.$fields['name'].' ('.$count.')</a></li>';
}
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
User avatar
DarrenDriven
Master Bludit
Posts: 69
Joined: Thu Jan 07, 2016 9:39 am
Location: Portland OR
Contact:

Oh man, I can tell that this is going to be the perfect framework to structure my new site around. Thanks!
User avatar
DarrenDriven
Master Bludit
Posts: 69
Joined: Thu Jan 07, 2016 9:39 am
Location: Portland OR
Contact:

Hmm... adding sort there breaks the array. The tag list prints out sorted, but the $count for each tag is zero (0) and the $tagKey for each line is just sorted numerically from zero up.

I'm VERY rusty at this, and there is probably a more elegant way of doing it... but for others who want to copy and paste, I got it to work...

Code: Select all

		
foreach($db as $tagKey=>$fields)
{
	$count = $dbTags->countPostsByTag($tagKey);

	// Save the unsorted HTML to a temporary array
	$temptaglist[] = '<li><a href="'.HTML_PATH_ROOT.$filter.'/'.$tagKey.'">'.$fields['name'].' ('.$count.')</a></li>';
}
sort($temptaglist); // Sort the temporary array alphabetically
//Go through the sorted array and print each line
foreach ($temptaglist as $thistag)
{
	$html .= $thistag;
}
User avatar
Edi
Site Admin
Posts: 3121
Joined: Sun Aug 09, 2015 5:01 pm
Location: Zurich
Has thanked: 54 times
Been thanked: 77 times
Contact:

Thank you for reporting this. On my test environment was only one entry for each tag...

The sorting will be part of one of the next releases.
Clickwork - Websites mit Bludit | Planet Bludit - Tipps und Snippets
Post Reply