How to Display Dates Nicely
Sometimes, events dates span more than one month, and we need a way to output them nicely. For example, an event that runs from January 27 to February 2.
This macro will do the trick.
Here are a few of the most recent recipes from the Craft Cookbook. Check out the recipes section for more tips and tricks.
Sometimes, events dates span more than one month, and we need a way to output them nicely. For example, an event that runs from January 27 to February 2.
This macro will do the trick.
I have an entry form on the front-end of my site that users can publicly submit to create entries in my channel. After the form submits, instead of listing out each erroneous field’s error under the field itself, how do I get a list of all the errors in one go? The example shown in the docs only shows how to get an error per field but not in one big list like:
Errors:
You want to change the values to fields in entries, users, etc, using Craft 3 but you are not a MySQL expert.
For example, let’s say you have 1000 entries in a channel and you want to change the value of one field from “Foo” to “Bar”. Manually changing it in the CMS and saving each entry by hand is out of the question. You could run an SQL query in the database itself but you don’t know what you’re doing. This trick will make it easier for you.
While Craft tracks entry status through a combination of enabled/disabled and entry date, sometimes you need a different type of status tracking, for example, as part of your editorial workflow. In this example, we’re tracking sessions at an event, and each session must go through a review, approval, and scheduling process.
Our statuses are Approved, Pending, Live, Rejected.
I tried and rejected several field plugins, like Colour Swatches and Iconpicker, because they would not display in the entries list view.
You need three things to accomplish this:
The CSS is super simple. I just adapted it from Craft’s own CSS.
You want to setup a Bootstrap 4 Navbar and use native functions in Craft 3 to manage the navigation menu.
You want to setup a Bootstrap 4 Navbar and use Navee to manage the navigation menu in Craft.
You want to display images without writing lots of code or repeating yourself.
You’ve installed Craft on a server running MySQL 5.7.5+, and have encountered the dreaded GROUP BY incompatible with sql_mode=only_full_group_by
error.
You need to dynamically load one or more dynamic elements to the DOM. Those elements need to pull from your entries, without reloading the page.
And it would be great if you could also use those same templates normally, even without AJAX!
You have multiple environments, and you want to keep environment-specific data out of your Git repo.