Questions tagged [entries]

Entries hold the content that you want to display on your web pages. Each entry has an Author, a Post Date, an Expiration Date (if desired), a status (enabled or disabled), and, of course, content.

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

Can't find the "share entry" functionality

I have Craft Pro (2.1.2564) and cannot locate the "share" functionality outlined below. When I edit an entry, The Live Preview button in Chrome (OSX) has only the Live Preview button with ...
2
votes
2answers
314 views

Sharing a template with identical category and tag name

I'm trying to stay as DRY as possible here and sharing one template for a news list view; all, category and tag all sharing the same template (and trying to refrain from having a category or tag ...
2
votes
1answer
183 views

Setting a conditional for username in URL?

Similarly to how Craft knows that a category is defined when a category slug is used, is there a way to detect a user in the same way? {% if category is defined %} ... {% endif %} Something along ...
3
votes
1answer
2k views

How could I have a plugin hook into when I edit or update a post?

What I am trying to do is have my plugin know when I edit a post that is part of a particular section - let's call it "parts" - which then checks to see if a field is filled out in the form and then ...
5
votes
2answers
2k views

How to save a matrix content of a new entry in my plugin?

I have a section of type channel with a matrix field. I want to know how I would save the matrix content while I save the entry as well. I know I can save the entry as follows: $entry = new ...
8
votes
1answer
8k views

Order entries by date field

I have a channel section with a handle named 'events'. In my field layout for this section I have a field named eventsDate, which is a Date/Time field. I also have a plain text field called '...
2
votes
1answer
1k views

Whats the best way to save a new entry in my plugin?

I have a channel section by the name of order. What I need is that every time a user clicks a button on the front end the data of the form is sent to my plugin which then uses the data to create a new ...
4
votes
1answer
144 views

Can I stop the logged-in user from selecting other users in the author dropdown?

I have a member group that has very fine grain options when they log in. They should only be able to add, edit, and delete their own entries in a single channel. At the moment they can select any user ...
8
votes
2answers
627 views

Is it possible to create a fieldtype that creates a many to many relationship between two entry sections?

So, for example: Say I have two sections: - Recipes - Ingredients Recipes can have many ingredients. Ingredients can have many recipes. If I'm editing a Recipe, I can edit the ingredients. This ...
6
votes
2answers
1k views

How do I get a random entry's URL from a Entries field?

I have a Entries field and I'd like to return a URL for one randomly picked entry. I could loop through all the entries, but I'd like to do something more efficient. Can I return an array of URLs? Or ...
3
votes
1answer
1k views

Filter channel entries by slug

Is there any way to output the content of a channel entry by their slug? For example, say I have an asset field called "image" in each channel entry, I want to output the content of that field only ...
6
votes
1answer
2k views

How do you return a message if no entries are found?

I thought this would be very easy but I'm having a hard time figuring it out. How do you output a warning/message if there are no entries to loop through? {% set entries = craft.entries.section('...
11
votes
2answers
2k views

Can I get an entry by Matrix Block ID?

For a url like domain.com/example/123 where 123 is a Matrix Block ID (not an Entry ID), can I get the associated entry for given block ID in a template? Or, for a more general approach, what would be ...
4
votes
4answers
2k views

Looking to use a tag slug/URI and loop through entries of that tag

It doesn't appear that tags are handled the same way as categories in the sense that categories have a slug (which results to a URI). I'd like to use tags to link to a "tag" page, similar to a ...
2
votes
1answer
168 views

Do something if first entry of a year

I'm outputting a timeline for company history and i'd like to add a graphic for the Year before the first entry of each year. My current code is as follows: {% set companyHistory = craft.entries....
5
votes
1answer
799 views

How can I set my upload path by date?

I have a directory structure in place that I'd like to mimic in Craft. File uploads are first categorised by Year, then by month so the directory sturcture is like such -- 2014 ---- 01 ---- 02 ---- ...
4
votes
2answers
665 views

Where and how should you listen for entry delete in plugin?

When an entry is created with my plugin's field type, data is saved to a separate table with entries id for reference. I need to delete that data if the entry that is associated with the data is ...
9
votes
1answer
2k views

How do I list entries from a single author?

I'm returning the username as the second segment /blog/username and then setting the username var to craft.request.segment(2). I'm looking to list a group of entries by that author (username). I've ...
1
vote
1answer
637 views

Overwrite entry.title in template

Does anybody know if it is possible to overwrite entry.title in a template? The following 2 options causes errors: {% set entry.title = 'value' %} {% set entry['title'] = 'value' %}
2
votes
3answers
331 views

Should I use tags for cities?

I would like to have some advise on the following: I'll be running a site with events. These events (channel entries) will take place in a certain city. I don't want to setup every city as a category,...
2
votes
1answer
1k views

How do I pull related entries and assets?

I'm having a bit of a hard time wrapping my head around exactly how to work with both Relationships and Assets. Here is my current problem that I seem to be stumped on, i'm sure once I get this going ...
2
votes
1answer
1k views

Is there a way to remove or filter out duplicate entries?

I have imported some data for a client, and it turns out there are some duplicates in the csv-files. Is there an easy way to remove or filter out duplicates, either in my entries-query or in my ...
1
vote
2answers
351 views

Unable to set slug to value used previously

I have an entry whose slug I would like to set to 'archive', but when I save it, it is 'archive-1'. There is no existing entry with slug of 'archive' (craft.entries.slug('archive') returns null). ...
3
votes
1answer
810 views

Ordering of ElementCriteriaModel with varying statuses

I have a built a little plugin that calls the Twitter API to add new Tweets from a user timeline as entries, so that I can return them in an ElementCriteriaModel request to be integrated with content ...
7
votes
2answers
4k views

Do I need a plugin to load entries via AJAX?

I want to load some entries via AJAX. I have a page that normally shows all entries of a specific type with user-selectable filters. I want to load filtered entries via AJAX. Do I need to create a ...
17
votes
4answers
49k views

How do I target the first item in a Twig for loop?

I'm looping through some images and want to target just the first image. How do I do that? {% for image in entry.images %} <img src="{{ image.url }}" alt="{{ image.title }}"> {% endfor %}
6
votes
1answer
383 views

Return entry where matrix field is not empty

I am trying to get a random entry which has the quote matrix field populated. I've tried this: {% set entry = craft.entries.section('entries').quote(':notempty:').order('RAND()').limit(1) %} That ...
5
votes
1answer
2k views

How do I use an if/else statement to determine if a field is filled in?

I know how to add images into my template: {% set image = entry.featureImage.first() %} <div class="imagewrapper"> <img src="{{ image.getUrl() }}" width="{{ image.getWidth('banner') }}" ...
4
votes
1answer
2k views

Listing categories alphabetically & total post count

How do I list all categories in use alphabetically? And how to get the total post count from each category? Cheers
4
votes
1answer
3k views

How to loop through category group and identify those related to entry

Looping through a category group to show links to all the categories. This is an entry page and I want to highlight any categories assigned to the entry. How do I do that? I've tried this so far: {% ...
12
votes
2answers
1k views

What are the differences between an elementCriteriaModel and fetched elements?

I am a little confused about the differences between an elementCriteriaModel and fetched elements. Why do I sometimes have to fetch elements with first(), last(), find(): {% set entries = craft....
5
votes
2answers
1k views

Creating a date filtered archive template

I'm trying to create an archive list template that lists entries from a News or Blog Channel based on year/month/day combinations. However, I get no entries and can't see where I'm going wrong...I'm ...
17
votes
1answer
1k views

How to show events for "This Weekend, Next Week"

Stemming from this original post I was able to show Events using a custom date field and successfully got "Today" and "Tomorrow" events to show up. How would I go about doing some custom Math to show ...
7
votes
1answer
436 views

How Do I show advanced Date filters for Events?

I am trying to setup an events section similar to that of Yelp's Events. They have a listing of all the upcoming events and have filters on the side for "Today, Tomorrow" etc... I received help from ...
5
votes
1answer
184 views

How do I add Entry Types to URL?

In the Sections settings ("Entry URL Format") I would like to add an entry property tag for Entry Type. discography/{slug}
5
votes
2answers
1k views

Tag to fetch URL and Title of a entry when supplied it's ID

I have a number of places in my templates where a link to a particular entry is needed to be hardcoded into the template, but we still want that links URL and title to be dynamic, so if the URL or ...
9
votes
2answers
432 views

How would I allow guests to add comments and ratings to existent entries?

I have a page with a bunch of images that I'd like people to rate and comment on. The rating would be a select custom field, and the comment would be a simple textarea custom field. I'd like to ...

1
15 16 17 18
19