Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 4466

Categories are taxonomies for your entries, users, and assets.

1 vote

Two sections sharing one category group

I'd say you want to look at the relations https://craftcms.com/docs/relations#the-relatedTo-param You would then use craft.entries.section( 'sectionHandle' ).relatedTo( category ) to grab all entries …
Luke Pearce's user avatar
  • 3,863
4 votes
Accepted

Find matching asset (image) for category

I would add the brand category field to the assets field set. This way you can add brands to images and use .relatedTo to find them. <ul> {% for category in craft.categories.group( 'brands' ) %} …
Luke Pearce's user avatar
  • 3,863
2 votes
Accepted

Canonical url for product with multiple categories

You should be able to use {{ entry.categoryFieldHandle[0].slug }}. The [0] simply grabs the first category in the field. You will need to make sure there is always at least one category allocated to …
Luke Pearce's user avatar
  • 3,863
4 votes
Accepted

Loop through entries that share current entry category and restrict to Cat Group Id

An example of how this would be implemented in the above use case would be as follows {% set categories = craft.categories.slug( 'not preferential' ) %} {% set entries = craft.entries.relatedTo( categories … ( 'sectionHandle' ).relatedTo( categories ) %} …
Luke Pearce's user avatar
  • 3,863
2 votes
Accepted

Sort entries in a category or entries field?

You can then output each product grouped by category with something along the lines of: {% for cat in categories %} {% set products = products.relatedTo( cat ) %} {% for product in products %} …
Luke Pearce's user avatar
  • 3,863
4 votes
Accepted

Show all tags related to a category?

You can use the relatedTo param on craft.tags like you can with any Element inside Craft. All Elements inside Craft can be related to one another. There is a .relatedTo parameter available on all of …
Luke Pearce's user avatar
  • 3,863
2 votes

Set Twig variable with javascript/jquery for displaying entries based on clicked value

The Twig code to fetch entries occurs on page load - Your JS code will run after the page loads and won't be able to update/fetch new entries. Instead, you should look at building a system that uses q …
Luke Pearce's user avatar
  • 3,863