13 votes

How do image focal points work in Craft 3?

While we’re piggybacking, here’s a snippet that goes one step further and generates the necessary CSS to position an untransformed image: {% set img = entry.headingImage.one %} {% if img %} {% ...
Dom Stubbs's user avatar
6 votes

Is there a tool to migrate Joomla/K2 entries into Craft?

I'm not sure there is anything specifically for importing from Joomla, but you could try the Import plugin. Depending on the data format, you may also be able to use the Feed Me plugin. Edit: ...
Steve Holland's user avatar
6 votes

What if I continue my website using Craft CMS Pro trial?

They have answered this on the CraftCMS site: https://craftcms.com/support/license-enforcement Edition Enforcement Each time Craft phones home to check for updates, we check the incoming license to ...
joe's user avatar
  • 449
6 votes
Accepted

How do image focal points work in Craft 3?

Focal points are used mainly for when Asset transforms (i.e. cropping) are performed in Craft. They tell Craft where it should focus on the image when performing these actions.
Brad Bell's user avatar
  • 67.3k
6 votes
Accepted

Live preview + share button missing when switching to PRO licence

I've seen something similar happen. I don't know the cause of it, but the solution in the 2 cases I know of each has the same fix. What happened was that for some reason, the "preview targets" got ...
John Morton's user avatar
5 votes

redirect index.php in urls on Craft site to NEVER show index.php

As another option that I usually do in addition to .htaccess, is to also add this to the array in craft/config/general.php file, and it'll stop Craft from ever adding the index.php. '...
Taylor Daughtry's user avatar
5 votes
Accepted

How do you get a section's ID

getSectionByHandle doesn't return an array, but a single SectionModel - so you need to remove the for loop: {% set enroll = craft.sections.getSectionByHandle('workshopEnrollments') %} {{ enroll.id }}...
Mats Mikkel Rummelhoff's user avatar
5 votes
Accepted

After upgrading to PHP 7 I started getting "storage folder isn't writable by PHP" errors

Try resetting the permissions of the storage folder: https://craftcms.com/docs/installing#step-2-set-the-permissions (It's possible that PHP was running with higher-than-default permissions in the ...
Michael Rog's user avatar
  • 3,400
5 votes
Accepted

Passing JSON to Twig

The answer is to create a custom plugin that will read the json files from the folders in the public directory, parse the json, and pull them into the template. An alternative solution is to use ...
Sam Hernandez's user avatar
5 votes

Seeking information on the largest Craft sites built

Stack Exchange is generally for more technical questions, so you might not get many replies here. Have you contacted the folks at Pixel & Tonic directly? You could also join the Craft CMS Slack. ...
Steve Holland's user avatar
4 votes
Accepted

How to remove relationships between entries

A relationship field expects an array of element IDs. So to remove a user, you'd just get all the current IDs and remove the one you want to delete. // Get the current member IDs $members = $entry-&...
carlcs's user avatar
  • 36.2k
4 votes

How do you get a section's ID

Updated for Craft 4: {% set enroll = craft.app.sections.getSectionByHandle('workshopEnrollments') %}
Mosswalker's user avatar
4 votes
Accepted

On Entry Creation Redirect

You'd have to write a custom plugin, that adds an event listener for the entries.saveEntry event. The event listener should go into your plugin's primary class' init method. You'll need to make sure ...
Mats Mikkel Rummelhoff's user avatar
4 votes
Accepted

redirect index.php in urls on Craft site to NEVER show index.php

This came up in the Craft Slack not so long ago. You'd want something like this... # ------------------------------------------------------------ # Remove index.php # ---------------------------------...
Jamie Pittock's user avatar
4 votes
Accepted

Excluding an include template

There may be a better way, including adding exclusions as an array and checking if the segment exists in the array, but what about wrapping it in an if tag? This seems to work. {% if craft.request....
Shift2Design's user avatar
4 votes

Getting column not found when using 'Entry::find()' to find the matching channel entry in custom plugin

All custom fields get the field_ prefix and a pseudo-random suffix like _ywsmdgzc for their column name in the database. If you want to use custom conditions in a query, you need to include both. To ...
MoritzLost's user avatar
  • 10.7k
3 votes
Accepted

Equivalent of EE admin info code

Not exactly. But if you're looking for stats, devMode does some query profiling right in the console: I'm not sure if you're looking for a 1-1 correlation but you can obtain whether or not the server ...
RitterKnight's user avatar
  • 6,582
3 votes
Accepted

Migrating Joomla K2 nested categories

Craft supports hierarchical, nested categories out of the box. It also supports hierarchical entries, assuming you used the Structure section type (and not a channel or single). Where Craft and ...
RitterKnight's user avatar
  • 6,582
3 votes

Members' site in Craft possible out of the box?

Yes: In Craft, all Elements — including Users — can have custom fields of their own. (So, for example, each User could have a "Bio" field.) You can use a User Profile Form to allow Users to edit ...
Michael Rog's user avatar
  • 3,400
3 votes

Excluding an include template

Another way would be to use: {% include [ '_globals/footer-' ~ craft.request.lastSegment, '_globals/footer' ] %} You'd then have your regular footer.twig for all pages, but you could have a ...
ianp's user avatar
  • 163
3 votes

What if I continue my website using Craft CMS Pro trial?

You can locally, but launching the project into the wild, you will need a pro license.
Brad's user avatar
  • 487
3 votes

Website not indexing

You need to tell Google that you have a new site or the best SEO in the world won't matter a jot; Google has no idea your site exists until you tell it. There are 4 essential steps to getting your ...
Seth Warburton's user avatar
3 votes

How can I import users from WordPress to Craft CMS?

I don't know how to export users from WordPress, but importing them in Craft can be done with a plugin like Feed Me. There are other plugins out there too depending on the export file you can get out ...
Tom De Smet's user avatar
  • 1,456
3 votes

How to insert a Sprout Form into a new page in Craft CMS

If you don't have a local development environment setup, you will need FTP access to the server where Craft is installed to edit templates. The one line of code cannot be copied and pasted into a ...
Cavell Blood's user avatar
3 votes
Accepted

Craft CMS Backing React FE using the element API

I created a react native app with Craft CMS (still version 2.6) as backend using the Element API. But you're right, user authentication is not supported by the Element API. However, I created my own ...
Sven Jungnickel's user avatar
3 votes

How do image focal points work in Craft 3?

To piggyback off Brad, Focal Points tell craft where to crop the image but can also be used to position background images. Here's how you can get focal point positions: {% if slide....
Matthew Rotter's user avatar
3 votes
Accepted

Set UserGroups for existing User

You can assign a user to certain groups via Craft::$app->getUsers()->assignUserToGroups($user->id, [1,2,3]); Would assign them to the groups with the ids 1, 2 and 3
Robin Schambach's user avatar
3 votes
Accepted

Get entries that are enabled and disabled for the site

With the help of Oli from Craft, it turns out the solution is simpler than I thought: {% set items = craft .entries() .section('works') .anyStatus() .all() %} This returns all ...
Panos Spiliotis's user avatar
2 votes
Accepted

users.onSaveUser firing multiple times

This burned me awhile back. As I understand it, your code is not just running 44 times, it's actually running an endless loop... until it blows up (and likely runs out of memory). Basically when you ...
RitterKnight's user avatar
  • 6,582
2 votes
Accepted

Can a non-admin add Entry types into a section?

You would have to write a custom plugin that provided its own UI (outside of the Settings portion of the control panel) and that plugin's controller could mimic Craft's SectionsController (with the ...
Brad Bell's user avatar
  • 67.3k

Only top scored, non community-wiki answers of a minimum length are eligible