Questions tagged [sections]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
17
votes
1answer
1k views

How to handle top-level/index pages in structure sections?

It seems that currently if you want to avoid the main "about" page at the top of an "about" structure having a slug of /about/about/ then the approach people seem to take is to create an About page as ...
16
votes
3answers
22k views

How to return a specific entry?

Hopefully this is a simple question but I couldn't find a clear answer anywhere - I just want to be able to pull in data from a specific entry, where I know the identifier. In this particular case, ...
14
votes
1answer
3k views

Is it possible to exclude multiple sections from an entry search query?

I'm trying to build a search function that excludes results from certain sections all together. This is the code I was trying to use. {% set entries = craft.entries.search(query).section('not ...
14
votes
1answer
10k views

Get the current section handle

I can't help but think this is a silly/obvious question, but I'm trying to retrieve the current section handle so I can use it as a class. Maybe I'm going about it wrong, but {{ handle }} does ...
12
votes
1answer
2k views

Changed section from Channel to Structure, but can't re-order entries

As the title says, I changed a section from Channel to Structure, but when clicking on that section in the dashboard, the layout still looks like a Channel, and I'm not able to reorder/drag the ...
12
votes
1answer
6k views

How to get one random entry from among multiple sections

I'm trying to pull a random entry from among an array of sections, but I can't get it to work. I tried the code below, but I'm just getting errors. I've tried multiple ways of listing the sections -- ...
12
votes
1answer
2k views

Move entries between sections

I have some entries that I'd like to move to a different channel, but I don't see any way to do this. Is it possible?
11
votes
1answer
2k views

How to create a CMS editable channel section index page?

If I have a section called 'blog', and its handle is 'blog', and it's a Channel, all of the entries appear under http://mysite.com/blog/{slug} - which is great; but how would I create a page at mysite....
8
votes
2answers
2k views

Output children of a structure section in reverse order

How do you output the all the children of a structure in a reverse order (assuming the children are limited to max depth). Using the order parameter, Craft requires that you use a second parameter ...
8
votes
2answers
351 views

Is there any way to set a default status for Entries, either globally or per Section?

The subject more or less covers it — is there any way to set the default status for Entries, either on a Section by Section basis, or globally? I have a client that doesn't want to accidentally set ...
7
votes
3answers
581 views

Can I extend entries listing views (currently or in the future)?

Is there a way to show custom columns in the backend with entries listing views? Or can it be a feature in the future? For example: show category as a column in the news overview in the backend
5
votes
2answers
5k views

How can you get an entry type's name from its handle in a template?

Each of my entry types have their own template. The url is something like: /foo/{entryTypeHandle} And the route is: 'foo/(?P<routesEntryTypeHandle>[-\w]+)' => 'bar.html' In the template ...
5
votes
3answers
3k views

How to use a Structure including a homepage

As far as I can tell, it's mandatory to have a Single as the site index. I always use a Structure for organising my pages, and different entry types for different page templates. I intend to use a ...
5
votes
1answer
3k views

Loading javascript on specific sections/pages

What is the recommended way to add section specific javascript to entry pages? I need to make some 3rd party api calls front end for currency conversion but I want to only use it on a specific ...
5
votes
2answers
578 views

A Structure section with an entry to a channel index

I don't have commenting privileges yet, so couldn't comment on either of these posts (here and here) regarding an entry in a Structure section that links to a Channel index. Between the two posts ...
5
votes
1answer
596 views

Set Default Entry Types for elements in a Structure Section

I have a Structure Section controlling my Nav and page contents So I have Home About Us History List item List item Services Service 1 Service 2 Service 3 In the Control Panel when I add ...
5
votes
1answer
891 views

Output URL to section

Is it possible to output the path to a given section? I'm using this to define the section model for the contact page (a single): {% set contactPage = craft.entries.section('contact') %} But then, ...
5
votes
2answers
1k views

Updating all entries URIs after changing entry URL format

After publishing some entries, I've changed the section setting "Entry URL Format" from news/{slug} to news/{id} but I had to re-save every entry to reflect the change. Is there a better and fast way ...
5
votes
1answer
598 views

Use postDate in section title format field

I'm trying to generate titles for a section's entries based off of the given post date (if it exists). Here's the configuration I've got in the Title Format field for this section's entry types: New ...
5
votes
1answer
727 views

Using multiple sections VS a single section with entry types

I'm just planning ahead for a project and was hoping for a second opinion. I'm going to be making a site that will have about 7 different types of entry - all of which have different fields/URL's; ...
4
votes
2answers
931 views

Building a website containing restaurant menus from multiple vendors — need some advice on Section hierarchy of data

Figure I'd query with the geniuses over on StackExchange as I think I've hit a roadblock in my project. I'm building a website containing menus from multiple restaurants with the vision that it could ...
4
votes
1answer
134 views

Section Single Title Caching

I have the following - {% set press = craft.entries.section('press').first() %} {{ press.title }} If I change the section title in the Sections area of the back end from something like "Press" to "...
4
votes
2answers
322 views

Why would I choose Channels as opposed to Structures

I can sort structures alphabetically, by date or by specific field. Structures also allow me to sort by the order specified in the Control Panel. So what is the use case for using Channels instead of ...
4
votes
1answer
992 views

Sections, Categories, and EntryTypes. Which, when?

bit of a 'best practice' question, as I'm very sure there are many ways to do this sort of thing, but... When/how do you decide whether to use a section, category, or entry type to organise your ...
4
votes
1answer
508 views

Use global values in the Entry URL Format field

I'm trying to use global variables in Entry URLs generated by Craft, but they seem to be empty. Not getting any errors as such, just null. My Entry URL format looks like this: {{siteDefaults....
4
votes
2answers
604 views

Structure(s) vs. Categories for product catalog

So I am working on a project that includes an online product catalog. Is there a recommended way of setting up a catalog regarding the use of structure(s) vs. categories or a combination both? I ...
4
votes
2answers
548 views

Can I use translated properties for URL formats

Here's my scenario. I have a structure section: "events". Within that I have three entry types: "events", "exhibitions", "specials". I would like the events to follow the following URL structure: {...
4
votes
1answer
423 views

Easy way to copy sections to a new install

Is there an way way to copy sections I have in an existing site to a new website I am doing with a fresh install? E.g. To Copy the News Channel Section and all the field types Also copy the structure ...
3
votes
2answers
3k views

How do I return ALL entries that are singles

I'm trying to generate a sitemap and wish to output all the entries that have a section type of 'single' but can't get the the correct syntax. All of the entries need to return 'single' for {entry....
3
votes
1answer
3k views

How does the Structure section type work?

I read the documentation but I'm still confused about the Structure sections.. What they are usually used for? What are the advantages of using it? And most important how to use them? Please can you ...
3
votes
2answers
653 views

Most efficient way to check if a section has any active entries

Just wondering what the most efficient way to check whether a section has any entries or not. Based on this, I'm showing some content. The content doesn't take any information from the entries in the ...
3
votes
1answer
330 views

Best way to find sectionId by slug

What would be the best way of finding a sectionId by its slug within my plugin?
3
votes
2answers
841 views

Custom navigation URLs?

I have an existing ExpressionEngine site which I'm looking at moving to using Craft instead. Only really had a quick cursory glance at the system so far but a little confused on a few things. Say ...
3
votes
2answers
2k views

How do you page through child entries in a structure?

I am trying to figure out how to page through only the children of the top level section entry being displayed, I have looked at this question but as I say I am after only the children not the ...
3
votes
1answer
410 views

How can you check if a field exists in a section, not by entry?

For a plugin, I need to check if a certain field exists in a section. How can i manage that? I'm using the settings section from the plugin, looping through all sections by craft()->sections->...
3
votes
1answer
1k views

How do I sort a collection of entries from multiple sections by date?

I want to create a featured story slider on my website and gather the latest entries from multiple channels to populate it. Here is what is working: # fetch the entries {% set featuredBlog = craft....
3
votes
1answer
690 views

How to check if on a channel/category index?

In the previous question I asked for a way to detect the 404 page from a plugin. Brandon gave me a good starting point with this answer. However, I wondered what method I could use to also detect ...
3
votes
1answer
956 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 ...
3
votes
1answer
302 views

Can Section access be restricted at Entry Type level?

I have a structure section that is driving the majority of a site, which works great with multiple entry types letting us handle different needs across different areas of the site. The client now ...
3
votes
1answer
413 views

Localization - Getting page not found from CP when trying to edit new locale

I've set up a new locale fr_ca according to the localization guide. I've defined my site url's accordingly and set the files like so that english is on the top level and an fr_ca folder contains the ...
3
votes
1answer
527 views

Linking to channel via structure section

I apologize for opening up a whole new question for this topic since it's been discussed a few times now, however I don't have enough rep yet to comment on the existing questions. Regarding the ...
3
votes
1answer
495 views

How to handle custom text on a channel index page?

I'm setting up a site with several channels, and the design requires an introductory paragraph at the top of each channel's index page (ie. before the list of entries) - essentially a post that ...
3
votes
1answer
75 views

Section/category setup input

Looking for some input on how to setup a Craft site. I have 2 sections of the site containing content grouped by the same set of topics (or categories). For example, within Services there 6 sub-...
3
votes
1answer
555 views

Channels within Structures?

I have a site that requires the client to reorder their entries in each 'category' manually. Obviously structures are perfect for this but where I'm running into trouble is that the entries need to ...
2
votes
4answers
3k views

Get the URL of a section?

Similar to this question: Output URL to section Let's say we have a section with handle 'places' which defines its URL format as 'places/{slug}'—how do I get the link to the 'places' index page? The ...
2
votes
2answers
854 views

How should an index page be setup/defined in Craft?

Site construct question... I have categories. Craft knows where to find the template for a category - i.e. markets/{slug}. But I also have a Markets (categories) page with the first 6 entries ...
2
votes
2answers
100 views

List most recent items combined from Channel and Structure sections

If we pass through an array of Channels & Structure sections we find that Channels entries tend to be listed first. So the first 15 will comprise of ChannelOne and ChannelTwo and then start ...
2
votes
1answer
235 views

Is there simpler, less assuming Craft documentation?

I'm really struggling with understanding how Craft works at the moment. I've been started mid-way on a particular project and I just can't get my head around how Craft works. Their documentation ...
2
votes
2answers
715 views

Linking to channel page

I'm just getting started with Craft. My problem is that I'd like the user to be able to change the location of call to action buttons on the site. Instead of allowing them to enter any URL, it would ...
2
votes
1answer
645 views

Order/sort a structure section by date too?

Is it possible to have a Structure section ordered by date (desc) as a default and then take the custom ordering in the CP into account?