8

You can insert an array of different sections instead of a single one to pull entries from multiple sections {% set entries = craft.entries.section(['sectionHandle', 'sectionHandleTwo']).limit(10) %} You can also write that {% set entries = craft.entries({ section: ['sectionHandle', 'sectionHandleTwo'], limit: 10 }) %} If you remove the .section() / ...


4

You could use the getNext() and getPrev() methods on your entry like this: {% set params = craft.entries.section('yoursection').order('postDate asc') %} {% set prevEntry = entry.getPrev(params) %} {% set nextEntry = entry.getNext(params) %} {# to access url, I use #} {{ prevEntry.url }} {# to access title, I use #} {{ prevEntry.title }} NOTE: I've ...


3

First: you need to create a Plugin, I suggest you to use Pluginfactory.io to create your boilerplate and read the docs about plugin development You'll need an ajax Request that could look like $('#a-button').click(function(){ var data = { entryIds: [1,2,3,4], // <- insert the id(s) of the entries you want to render action: '...


3

There's no problem re-using a variable name from a technical point of view. There is likely a problem elsewhere in your code.


2

This is totally untested but something like this could work (or at least give you some hints) edit: since I was bored I tested the code.. it works public function actionImport(){ $jsonData = // getYouJsonDatasomehow here foreach($jsonData as $json){ $entry = craft()->elements->getElementById($json['id']); /** @var \Craft\...


2

Maybe you already solved your issue but I wanted to explain what I did the last time... You can make use of the craft_content table and it's implementation in Craft 2 that fetches and includes all columns no matter of the field layout. Make use of the light switch field, if you already have one that you are not going to use in your specific entry type you ...


1

I'd first set up a 301 redirect to ensure that anyone who does land on one of these search engine indexed pages is redirected to the single page that lists them all. Then I'd just turn URLs off for that Section.


1

As a quick but not elegant fix, You can disabled the entries you don't want to show up in the url. When you want to use the content just put craft.entries({ section: someSection, status: null }) or craft.entries({....}).status(null)


1

You need to separate your criterias with commas listinglatitudenumber: 'and, ' ~ '>=' ~ pluginResults.latmin ~ ', <=' ~ pluginResults.latmin,


1

I think the answer you’re looking for is here. TL;DR: relatedTo method accepts a CategoryModel, not the title(slug) of a category.


1

You have to remove the entry from your entry.resourceType {% set allEntriesByCat = allEntries|group('resourceType') %} will work


1

You should read about how to create a plugin from the Craft docs, then you can create one with Pluginfactory.io I'll reload the entries with javascript in my example since I don't like reloading the page every single time and ajax is the way to go in these days. You can achieve this without any javascript/php code with only twig but users would have to ...


1

Found the solution, thanks to Aaron Berkowitz on How to get entries related to current category only (not children) You need to exclude the entries related to the subcategories. {% if category is defined %} {% set dontInclude = [] %} {% for child in craft.categories.descendantOf(category) %} {% set dontInclude = dontInclude|merge(craft....


1

You could use this, note: this is untested maybe you have to remove the first() or use targetElement: category1.id {% set category1 = craft.categories.id(yourId).one() %} {% set category2 = craft.categories.id(yourId2).one() %} {% set news = craft.entries.all({ section: 'news', relatedTo: [ 'and', { targetElement: category1.id }, ...


1

This is the corrected Twig code. I simply added {{ entry.title }} as an <li> item. This nav appears only on the page that I needed entry.title displaying. {% set navList = (entry.level == 2) ? entry : entry.getAncestors().level(2).first() %} {% if navList.hasDescendants %} <ul> {% set nav = navList.getDescendants() %} &...


Only top voted, non community-wiki answers of a minimum length are eligible