Questions tagged [entry]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
51 views

Retrieving entry just after saving it returns null

I'm having this issue where when I save an Entry and try to fetch right away I get a null. Example: $entry = new Entry([stuff here]); $entry->title = 'foo'; if (!Craft::$app->elements->...
2
votes
1answer
64 views

Save same Entry more than once with help of custom relations field

Is it possible to save the same Entry (red arrow) twice/more than once in one custom relations field? "Test Playlist" is a entry in a channel. Background: I have set up a playlist, where an entry ...
2
votes
1answer
58 views

Structure question (entry in entry?)

Let's say I have an auction website: 'Ads' would be a section -> channel The ads in it would be entries in the channel Let's say guest users can make an offer on the action/ad. I would like to save ...
2
votes
1answer
515 views

Display text field from Matrix of an Entry Field in Matrix

Question is similar to some others I've looked through but their solutions don't work as there are some differences. Currently this doesn't output any of the fields I try to access within the ...
2
votes
1answer
89 views

Output tags in the order they were added to an entry

Is it possible to output tags for an entry page in the order they were added to related entry? For example on a News page I would like to output any/all tags added to the News article on the specific ...
2
votes
1answer
183 views

Sorting entries based on an a bespoke algorithm

We have been asked to scope a solution for a new site build that we'd like to use Craft for. There is one requirement I'm not sure how we'd approach though. In Craft terms, we would have an Articles ...
2
votes
0answers
512 views

Updating a single custom field within an Entry

I've got the beginnings of a simple plugin to track views of an article page, just an entry with custom fields including 'dataViews' used below. Within Twig: {% do craft.demoPlugin.incrementView(...
2
votes
0answers
682 views

Asset dynamic subfolder paths referencing entry section not available until saved

I have an asset field within a matrix block, for which uploads are restricted to a single folder. The upload location path is set to {owner.section.handle}/{owner.slug}. Using this pattern the asset ...
1
vote
2answers
2k views

Set status in a plugin

I was wondering if it's possible to modify the status of an Entry within a plugin? I've tried setting the status property but I get a readonly error. $entry->status = $status
1
vote
2answers
1k views

Only display entries based on a field conditional

Hey I am trying to get 4 entries, but only want 4 that have a body length > 100. How would I accomplish this? {% for entry in craft.entries.section('artists').order('RAND()').limit(4) %} // only ...
1
vote
2answers
331 views

Create new entry from related Entry field

It would be really nice to create a new entry in a section (say "Dates"-channel) direct from a related entries field in another section (say "Events"-channel). Is this possible already, or are there ...
1
vote
2answers
982 views

Editing entry in front-end

I am trying to edit an entry automatically when you press a button. Is there a way to do this? A bit more detail: I have listed up a few entries, each with their own button. When I press the button ...
1
vote
2answers
2k views

How to modify and save a field in entry on EVENT_AFTER_SAVE in a plugin?

I'm trying to build my first little plugin. I'm stuck with a problem: I need to modify the value of the specific field reference, right after the saving of the entry because the new value is supposed ...
1
vote
1answer
113 views

Possible to filter an entry based on property?

Trying to pull in a limit of 2 events that are upcoming (so the event's eventDate should be newer than today). I currently have this: {% set entries = craft.entries.section('events').order('...
1
vote
1answer
279 views

Using Craft for publishing an online magazine

I was wondering if Craft is suitable for publishing online magazines. I was thinking about using a new structure for every issue/release. And entries for the actual content of an issue. Is this the ...
1
vote
3answers
939 views

Get the current entry element in the CP (edit entry view)?

You can listen to entries.onSaveEntry or entries.onDeleteEntry events and then get or modify the entry via $event->params['entry'];. But how would I get the entry element and its properties in the ...
1
vote
2answers
721 views

Auto Expire on entries

I need to automatically set the expire date of a new entry (only) from a specific section. I know that it's possible to do this via the frontend twig templates, however I need the user to have the ...
1
vote
1answer
2k views

Best way to deal with Impossible to access an attribute (“isEditable”) on a NULL variable (“”)

I've had this issue a few times & wanted to know if there is maybe a better way to deal with the following issue: Say I have this if on a page: {% if entry.isEditable %} <a href="{{ entry....
1
vote
1answer
149 views

Send email notification to admins when a new entry is created

Anyone written a simple plugin that does this out there? When a user submits a form on the frontend, it creates a new entry (with the default status set to disabled). I'd like to set it up so that the ...
1
vote
3answers
254 views

How to create a new Entry model in Craft 3?

I want to create a new entry for a section named 'drinks'(having section id= 6). The namespace of the file having this code is namespace putyourlightson\userguide\controllers;.I copied this code from ...
1
vote
1answer
2k views

How to save a new entry with custom fields - Craft 3

I'm trying to create a new Entry via PHP, with custom fields (Craft 3). I can save it, however my custom fields don't appear. I've tried using setFieldValue, as well as $entry->excerpt = 'Lorem...';...
1
vote
1answer
194 views

How to use category in auto generated title?

I have an entry which has a category field. I want an auto-generated title for this entry that uses the assigned category title (first category title in case of multiple categories). I am not sure ...
1
vote
1answer
429 views

Linking a page in a multilanguage website

Currently i am using this approach for linking to a entry(single page) of a structure, for example a cta button on the homepage which links to the contact page. {% cache %} {% set single = craft....
1
vote
2answers
199 views

How can I hide entries depending on which category they are associated with?

Right now, I have a staff profile page. Each person on the page has a category association (professional, leadership, student). When the students graduate, I want to add an 'alumni' category to their ...
1
vote
2answers
270 views

Can you lookup the value in a key-value array with the value in an entry field?

This might be impossible, but can you lookup a value in a key-value array with the value in a craft entry field? And perform math with it in twig? I'm trying to simplify my template code. I have a ...
1
vote
1answer
633 views

Getting checkbox options for a new entry, without having an entry

How would I get a list of all the checkbox options associated with a specific field, without having an entry to loop over? I'm using the same form for creating new entries and editing existing ones. ...
1
vote
1answer
6k views

Impossible to access an attribute (title) on a string variable

I have a Video section with a field called videoCategory. I'm trying to pull in the first category on the _entry.html template. I'm pretty much following the the last example in the documentation at: ...
1
vote
2answers
195 views

Targeting entries in a structure

In a structure like the following: Offices US Albuquerque [offices] Boston Chicago Denver ...
1
vote
1answer
44 views

Viewing Assets (PDFs) associated with an entry directly from that entry screen

I have a channel with an Assets field, designed to hold PDF files. It works fine to select one or more files, and/or upload files and select them. However, I'm wondering if there is a way to view a ...
1
vote
1answer
35 views

Where does Craft store HTML Templates?

I have recently been given access to a Craft site's control panel. I need to edit the homepage to add data in the footer. As I didn't create the Craft website, how can I access the HTML I need to add ...
1
vote
1answer
97 views

orderBy title, but remove the word “The” from titles

If I have a huge list of TV shows and Movies, many of them have "The" in the title, meaning they all get grouped together if you order by title. Is it possible to "filter out" a ...
1
vote
1answer
39 views

Help with an Entries field to an array I can use elsewhere

I have an Entries field so I can select a number of posts to feature in a "Hero" section on the home page, as well as a "most popular" section underneath it. However, the Hero ...
1
vote
1answer
326 views

Send entry as HTML email

Looking to build a hybrid news service that publishes to a website but also sends an entry to a mailing list. Has anyone done anything similar?
1
vote
1answer
174 views

Unique URI error

I am getting the following error when trying to save a structured entry: Could not generate a unique URI based on the URI format. Title of entry is: Hells Gate Mud Bath & Spa Slug: hells-gate-...
1
vote
1answer
136 views

Non-numeric characters in number field producing errors

Craft 3 is giving me this error when my client enters non-numeric characters into a number field on an entry: number_format() expects parameter 1 to be float, string given Is there a way for it to ...
1
vote
1answer
52 views

Entries from matrix should not appear in loop

I have a Matrix with an entry field. I have a Loop which is looping entries out of a section. Goal: The entries from the matrix should not appear in the loop of the section. So the Matrix defines ...
1
vote
1answer
371 views

How can I add programmatically a Tag after SAVE_ON event in case of Assets types

We have to update the Asset after the SAVE_ON event, and the Craft::$app->elements->saveElement($asset); Not seems to be working (it is getting timed out). So what is the best pratice to ...
1
vote
2answers
433 views

Sort entries by time part only of DateTime object

I am trying to filter and sort show entries by what time they begin display the current show I have two fields, startTimeand endTime, and while Craft lets me display only the time part in the ...
1
vote
2answers
118 views

Save an entry with tags

I have a project that the user choose a tag (tags are already created) and save the information. I try save a entry which has a tag field, all the stuff saves, but the tags don't. I try search ...
1
vote
1answer
646 views

Matrix Entry form

I'm trying to post a public entry form in a matrix field. I've added a count so that the block id is unique. However it's just clearing the matrix field and saving a single entry. {% set matrix = ...
1
vote
1answer
43 views

Grabbing an asset field from Page A to display on Page B

I'm trying to display an asset that the client has selected to show up on the main page, and have it display on a totally different page. This sounds simple but I keep getting errors (and im learning)....
1
vote
1answer
529 views

How to get fields from another section?

I need to get data from fields from another section. My code is: {% for kontaktEntry in craft.entries.section('kontakt').entry.kontakter %} <div> <a href=...
1
vote
2answers
710 views

{% block content %} is a no-go in template/subfolders

I’m on a mac running MAMP and my install is functional. Localhost will direct to and display files in “templates” but it wont fully cooperate with subfolders within templates, such as templates/news. ...
1
vote
1answer
1k views

Frontend form with relation to an entry

I have a field called "assetId" from Entry "A" with Field Type "Entries" and Source "B". How can I build a form so that a relation between these two entries will be established. In the craft backend ...
1
vote
1answer
995 views

Conditional check if Matrix block field is empty (no content)

I'm having a difficult time with what seems like a fairly straightforward problem: I'm listing businesses and their related hours of operation (days/times). I'd like to set up a conditional statement ...
1
vote
1answer
116 views

How to layout a tabbed div

After playing around with Craft CMS for awhile I'm a little curious how some of you would approach this. How would you add a tabbed div to an entry? An example of the tab div below, it's the first ...
1
vote
1answer
51 views

How to Make a Change to an Existing Page Go Live at a Particular Point in Time

In Craft, is it possible to make an edit to an already existing (live) page but be able to set a particular point in time that you want to change to go live? I know that you can set the post date and ...
1
vote
1answer
2k views

How do I format the date and time I got from an entry?

I am working on a project where the content manager can add events (entries). These events have a date, starting time and end time. The fields in the cms show the option for adding a date, time and ...
1
vote
1answer
264 views

What is the best way to have an entry for top-level categories?

I'm currently working on an eCommerce project with categories for products: - Category 1 - Sub-category 1 - Sub-category 2 - Sub-category 3 - Category 2 - Sub-category 1 - Sub-...
1
vote
1answer
782 views

Populate Lightswitch field from Frontend Entry Form

I have the following buttons on my frontend entry from (user editing one of their entries). The idea is to turn the lightswitch "on" (green) when entry is being marked as draft and "off" when ...