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 %}
{% ...
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: ...
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 ...
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.
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 ...
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.
'...
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 }}...
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 ...
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 ...
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. ...
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-&...
4
votes
How do you get a section's ID
Updated for Craft 4:
{% set enroll = craft.app.sections.getSectionByHandle('workshopEnrollments') %}
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 ...
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
# ---------------------------------...
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....
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 ...
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 ...
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 ...
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 ...
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 ...
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.
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 ...
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 ...
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 ...
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 ...
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....
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
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 ...
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 ...
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
craft-pro × 106craft3 × 23
plugin-development × 9
craft-features × 8
assets × 5
users × 5
localization × 5
templating × 4
plugin-craftcommerce × 4
admin × 4
entries × 3
plugins × 3
image-transforms × 3
performance × 3
permissions × 3
updates × 3
user-groups × 3
matrix × 2
categories × 2
control-panel × 2
database × 2
relations × 2
entry × 2
php × 2
config × 2