11
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 %}
{% ...
7
votes
Server respond is very long (25s). Is there a way to optimize the perfomance?
Let me try to turn this into a more valuable StackExchange for others who will find it, since the original poster apparently got help and solved his problem without participating here. We can see so ...
6
votes
How can I try Craft Pro?
Douglas's answer is correct... Also, if you'd simply like to try Craft Pro before purchasing it, you can do so while running Craft in your local environment.
https://craftcms.com/support/try-craft-...
6
votes
Accepted
Can plugin have two links in admin navigation?
The top links in the CP header are often called nav tabs.
Beyond the "default" nav tab for your plugin (pointing to the plugin's CP section), it's possible to declare additional tabs via the ...
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
Accepted
Formatting Slug {postDate.month} to 2 characters
You should just be able to do:
postDate|date('m')
postDate by itself should give you a DateTime object which you can then apply the filter to.
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
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
Server respond is very long (25s). Is there a way to optimize the perfomance?
You have a lot of matrix blocks; I'm guessing that's why your output is slow. It looks like your initial query doesn't depend on any other input, so you could probably cache the whole thing. I would ...
4
votes
Accepted
Change page elements based on geolocation
Let's get the easy question out of the way first... Don't use Craft's localization to handle this task. While the localization feature is amazing and powerful, it doesn't fit the needs you're ...
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
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....
3
votes
Can plugin have two links in admin navigation?
Do you mean have multiple tabbed content within your plugin admin area? If so yes that's possible you just need to add a tabs array in your template like so:
{% set tabs = {
tab1: { label: "Tab 1"|t,...
3
votes
Accepted
Create Plugin, Elementtype suggestion
You likely won't need to write a plugin at all – you can easily create different user groups (e.g. "Workers" and "Clients") from the Control Panel, and grant those groups different permissions. An ...
3
votes
How can I try Craft Pro?
Assuming it is already installed and running, there should be a link to upgrade in the footer of the control panel which generates a modal window with options to buy or try. Keep in mind you will need ...
3
votes
Accepted
Hide section on "Entries" tab
There’s no way to give a user group permission to create entries but not see those entries they created in the CP.
The only way to achieve what you want would be to write a plugin that provides its ...
3
votes
Detect device screen size in craft cms
I think you are going to struggle with this in Craft, you would need to do it through Javascript.
Craft runs off PHP which is a server side scripting language, you need a client side scripting ...
3
votes
Accepted
Mutliple logouts required on Multiple App Servers
It sounds like your sessions are not being sticky. How many servers?
Are you having to login multiple times as well to get things done?
Apart from what Brad mentioned, couple things I'd try if you ...
3
votes
Change page elements based on geolocation
I think that you've outlined the process perfectly. To put the pieces together I would suggest that you create a small plugin (perhaps using the trusty BusinessLogic plugin as a starting point). To ...
3
votes
How can I access disabled entries?
You would need to create a custom route in the Control Panel that matches the same basic routing as your entries. Then in the entry template, you need to add some extra code that pulls disabled ...
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
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 ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
craft-pro × 107craft3 × 24
plugin-development × 9
craft-features × 8
assets × 5
plugin-craftcommerce × 5
users × 5
localization × 5
templating × 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