If you need a quick answer on how to do something with Craft CMS, you’re in the right place.

or browse the recipes

Newest Recipes

Here are a few of the most recent recipes from the Craft Cookbook. Check out the recipes section for more tips and tricks.


Show All Back-end Validation Errors From an “Entry Form” Submission

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:

  • First Name cannot be blank.
  • My Custom Field cannot be blank.
  • Etc cannot be blank.

Read the full recipe →

Change a Field’s Value Across Selected Entries Using Craft 3

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.

Read the full recipe →

Create and Display Custom Quasi-status in the Control Panel

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:

  • Control Panel CSS plugin for Craft 3.
  • A little custom CSS added to the plugin’s settings.
  • A bit of extra HTML in a Radio field.

The CSS is super simple. I just adapted it from Craft’s own CSS.

Read the full recipe →

Add Repeating DOM Elements Via AJAX

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!

Read the full recipe →