Possible to sort blog posts by Month or Tags?

I understand that the blog function is quite simple, but wondering if it’s possible to sort the posts by month or categories?

Not at the moment but sorting by categories is planned and could come in the next release.

1 Like

If you don’t want to mess with the Pulse core files to do this yourself or wait for the feature in a future version of the CMS you could approximate the effect you are after in the client by filtering the posts using JavaScript.

This very crude example shows how you could show and hide posts based on their published month;
http://www.pureretro.co.uk/pulse/pulse4/blog

Take a look at the page source code and you’ll see it simply uses jQuery (it was already loaded on the page) to trawl through the posts and looks for the post date stamp. From this it extracts the month of the post and either shows or hides the parent div wrapper if it is the month we’re after.

I wouldn’t advocate doing things like this for anything more than a few posts as;

  1. For it to work we have to display all of the posts on the page (change the $result_per_page variable in the config to display all of your posts. Mine was set to 500) so the page will get very heavy.
  2. By displaying all of the posts we’re doing away with Pulse’s paging abilities.
  3. It isn’t very search engine aware as the content will get trawled regardless of the month selected.
  4. The way I’ve coded this it only works on the blog overview page (all posts)
1 Like

tags on the way @shidastudio2 :slight_smile:

are tags implemented, Michael?

Yes - but it’s saved for Pulse 5 as it requires a big core code rewrite.
the restructuring of the core code for 5 will allow a lot of new and wanted features to be added :slight_smile:

3 Likes

Hi Michael,
is there an ETA planned for Pulse 5?
Have you already thought about upgrade free/pricing?
Thanks, Igor

Thanks Igor! At the moment no, sorry, no ETA. It’s a big mission so taking a lot longer than I had expected. It will be worth it though. For now, the current Pulse 4 is a solid CMS.

I use the blog feature for news and announcements. Sometimes there are changes or additions in a post. I wanted them to be sorted by last modification date. It’s also possible to use the creation date.
If you do want to mess with the Pulse core files you can use this.
Pulse 4.5.2
file: /inc/tags/blog.php

find lines: 9-21:

$all_blog_files_folder = glob("content/blog/*");
natsort($all_blog_files_folder);

foreach ($all_blog_files_folder as $files) {    
    $resortfiles[] = $files;
}

foreach ($resortfiles as $blog_files) {    
    $file_info = pathinfo($blog_files);    
    $blog_id   = $file_info['filename'];    
    $all_blog_files[$blog_id] = array($blog_files, $blog_id);
    $all_blog_ids[] = $blog_id;
}

replace with:

$all_blog_files_folder = glob("content/blog/*");
// natsort($all_blog_files_folder); // pulse original
// usort($all_blog_files_folder, create_function('$a,$b', 'return filectime($a) - filectime($b);')); // sort by creation time 
usort($all_blog_files_folder, create_function('$a,$b', 'return filemtime($a) - filemtime($b);'));   // sort by last modification time

foreach ($all_blog_files_folder as $files) {    
    $resortfiles[] = $files;
}

$counter = 1; // pulse expects consecutively numbered blog_ids starting with "1"- step 1
foreach ($resortfiles as $blog_files) {    
    $file_info = pathinfo($blog_files);    
//  $blog_id   = $file_info['filename']; // pulse original
    $blog_id = $counter; // numbering step 2
    $all_blog_files[$blog_id] = array($blog_files, $blog_id);
    $all_blog_ids[] = $blog_id;
    $counter++; // numbering step 3
}
2 Likes

Blog posts can be added to Tags in the latest version.

Fixed in 5.0.2! :smiley::+1:
http://help.pulsecms.com/article/10-version-history