CodeIgniter Forums
Wordpress-like post short by date - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Wordpress-like post short by date (/showthread.php?tid=460)



Wordpress-like post short by date - FlevasGR - 12-07-2014

Hello, im working on a new project and i want to make a blog. The main blog is pretty simple. Just pulling the posts from the database. However i would like to have a wordpress-like short by date system. I f you dont know how it looks like take a screenshot:

[Image: archives-page.png]

It shorts the posts by month and year. The posts table is already keeping the creation date so i just have to process them.
I could make a model which gets all the posts from a specific month/year but i dont know how to display them like above. Any suggestion?


RE: Wordpress-like post short by date - Chroma - 12-09-2014

(12-07-2014, 07:35 AM)FlevasGR Wrote: Hello, im working on a new project and i want to make a blog. The main blog is pretty simple. Just pulling the posts from the database. However i would like to have a wordpress-like short by date system. I f you dont know how it looks like take a screenshot:

[Image: archives-page.png]

It shorts the posts by month and year. The posts table is already keeping the creation date so i just have to process them.
I could make a model which gets all the posts from a specific month/year but i dont know how to display them like above. Any suggestion?

It seems that they are displayed in a bulleted list, of type ul (unordered list).

Is that what you were asking?


RE: Wordpress-like post short by date - FlevasGR - 12-10-2014

I'm asking how to short the posts by month.


RE: Wordpress-like post short by date - Rufnex - 12-11-2014

You have to do this in your sql query by a order by clause over you date-field (date insert) witch must be a date datatype (date, datetime, timestamp).

PHP Code:
select [...] from table order by date_insert [asc|desc