sruupl / batflat

Lightweight, fast and easy CMS for free. Bootstrap ready. https://batflat.org
MIT License
134 stars 54 forks source link

Sort posts by tags #56

Closed senwmn closed 4 years ago

senwmn commented 4 years ago

Hi, love the CMS!

I'm still a beginner with backend development and am struggling to grasp how posts populate. I want to only display posts with specific tags on specific pages and add extra post fields which can be displayed in my markup. The end goal of my project is to have editable content for upcoming local events, so on my page I currently have a 2 column grid layout which i want to display each post in, howver i still ned to add more 'fields'. Some examples would be adding a date and location wyswig field to each post.

Heres my code (I've added different variable names to represent the new fields - you get the picture):

**{template: inc/header.html}

{template: inc/sidebar.html}

{$page.title}

{loop: $blog.posts} {/loop}
{template: inc/footer.html}

{template: inc/nav.html} {template: inc/scripts.html}**

Ive also tried adding to the site.php page but i'm not sure how to go about this. Sorry if its a bad question, didn't want to use wordpress and this was the best lightweight alternative i've found!

michu2k commented 4 years ago

Hello Thanks for choosing Batflat for your website! As for tags, there is already an answer about this feature here and here. Sadly in Polish, but you have the code and how it works. You need to edit _getLatestPosts() function (or create a new one). When it comes to additional 2 fields, unfortunately, I can't answer that question for you, because I need to reproduce it first, but don't have too much time now.

senwmn commented 4 years ago

Hey, thanks so much for the fast reply and linking the other features, I'll give them a try!

michu2k commented 4 years ago

The problem seems to be resolved. If you have further questions or problems, please create a new issue.