Skip to content Skip to sidebar Skip to footer

Guest Entries Upload New Asset Craft Cms

Entries

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

You lot tin also create drafts of entries that live aslope the current alive version of the entry.

Typically each entry will have a pale in its own principal URL on your site, though Arts and crafts tin can fetch any entry from anywhere if your template needs it.

# Sections

Before you tin can create entries, you must create Sections to contain them. In each Section you lot can define the following:

  • Whether entries in the section take URLs
  • What the entries' URLs should look similar
  • Which template should get loaded if an entry's URL is requested
  • What types of entries should be bachelor in the department, and which fields each of those entry types should have

If you're using Craft with multiple sites so you lot tin also define in your Section:

  • Which sites' entries in the department should target
  • Which sites are enabled by default for new entries

To create a new department, become to SettingsSections and choose New Section.

# Department Types

Arts and crafts has 3 dissimilar types of sections:

# Singles

Illustration of Entries layout with

Singles are used for one-off pages that take unique content requirements, such as:

  • the homepage
  • an Most United states page
  • a Contact U.s.a. page

Different the other department types, Singles just have ane entry associated with them, and they don't have an editable Author, Post Date, or Expiration Date.

# Channels

Illustration of Entries layout with a

Channels are used for streams of similar content, such every bit:

  • a Blog
  • a News section
  • recipes

# Structures

Structures are good for times when you lot need to store multiple similar entries, and sort them into a specific order. They tin can besides exist hierarchical.

Illustration of Entries layout with an

Unlike other sections, Structures have a "Structure" sort pick that provies the manually-ordered, elevate-and-drop hierarchy seen above:

Illustration of entry listing sort menu with

Examples include:

  • Documentation
  • a Services section, where the order of services matters
  • a visitor organization chart

# Entry URI Formats

Aqueduct and Construction sections tin cull whether their entries should exist assigned URLs in the organization, by filling in the "Entry URI Format" setting. (Singles have a "URI" setting.)

The template designated for an "Entry URI Format" or "URI" can employ a special entry variable that'due south automatically populated with the relevant section entry.

Entry URI Formats are mini Twig templates, which will be rendered each time an entry in the section is saved. The rendering effect will exist saved every bit the entry's URI in the arrangement.

The entry being saved will be available to the template as a variable named object, and each of the entry's properties and custom field values volition likewise be available as their own variables. So something like this is possible:

A shortcut syntax is also bachelor for output tags that reference a belongings on the entry:

Construction sections may want to have nested paths for child entries:

With the above Entry URI Format, a peak-level entry's URI might end up as templating, whereas a nested entry'due south URI might end upwardly every bit templating/tags.

Construction sections might also want to include a segment earlier the nested path:

The higher up template could also be expressed with this syntax:

With the above Entry URI Format, a acme-level entry'southward URI might end up as docs/templating, whereas a nested entry's URI might end up every bit docs/templating/tags.

You tin designate any one entry as a site'south homepage using a special __home__ URI.

Y'all can apply an attribute from a query in the entry'southward URI. Use double curly braces (due east.1000. {{craft.entries.section('mySingle').1().slug}}/news).

You can utilize aliases in the entry'southward URI. Use the allonym() function in double curly braces (e.g. {{alias(@rootUrl)}}/news, {{alias(@mySectionUri)}}). See Environmental Configuration to acquire more most how those work.

# Preview Targets

If you're using Arts and crafts Pro, your section can have 1 or more preview targets, which are URLs of pages that your entries will bear witness up on, making it possible for authors to preview entries every bit they are writing them in the command panel.

Similar entry URI formats, these preview target URLs are mini Twig templates that can incorporate entry properties and other dynamic values.

Employ single curly braces to render attributes on the entry. For example if entries in your section have their own URLs, then you lot can create a preview target for the entry's primary URL using the URL template, {url}.

Create additional preview targets for any other areas the entry might evidence up, such every bit news, or archive/{postDate|date('Y')}. If the entries prove up on the homepage, you can create a preview target with a bare URL.

A section's Preview Targets setting.

If you want to include the entry'due south ID or UID in a preview target URL, use {canonicalId} or {canonicalUid} rather than {id} or {uid}, so the source entry's ID or UID is used rather than the draft's.

You can use environment variables and aliases in the preview target URL. These practice not go wrapped in curly braces (due east.grand. $NEWS_INDEX, @rootUrl/news, @rootUrl/news/{slug}). Meet Ecology Configuration to learn more than about how those work.

Preview target URLs can include an attribute on the result of a query. Here double curly braces must be used (e.g. {{ arts and crafts.entries.section('mySingle').one().url }}).

When an author is editing an entry from a section with custom preview targets, the View button will exist replaced with a menu that lists the Chief entry page (if the section has an Entry URI Format), plus the names of each preview target.

An entry's View menu with 3 custom preview targets.

If you share a link from this menu that includes a preview token, it will expire by default after one mean solar day. You tin customize this with the defaultTokenDuration config setting.

The targets will also be bachelor within Preview.

# Previewing Decoupled Front Ends

If your site's forepart lives outside of Craft, for example as a Vue or React app, y'all tin can yet back up previewing drafts and revisions with Preview or Share buttons. To practise that, your front end must check for the existence of a token query cord parameter (or whatever your tokenParam config setting is set to). If it's in the URL, and so yous will need to laissez passer that same token in the Craft API request that loads the page content. This token will cause the API request to respond with the right content based on what'due south actually being previewed.

Y'all can pass the token via either a query cord parameter named after your tokenParam config setting, or an X-Craft-Token header.

For live preview, yous should also consider enabling iFrame Resizer so that Craft can maintain the page scroll position betwixt folio loads.

# Entry Types

Both Channel and Construction sections allow you ascertain multiple types of entries using Entry Types.

You tin manage your sections' Entry Types by choosing Edit Entry Types link abreast the section's name in SettingsSections. That'll take you to the section'southward entry type alphabetize. Choosing on an entry type's name takes you to its settings folio:

Entry Type Edit Settings

Entry types accept the following settings:

  • Name – The entry type's proper name
  • Handle – The entry type'southward template-facing handle
  • Testify the Title field? – Whether a Title field is displayed for entries of this type
  • Title Field Label – What the Title field label should exist.

# Dynamic Entry Titles

If you want your entries to take auto-generated titles rather than requiring authors to enter them, you can uncheck the Show the Title field? checkbox. When you lot practise, a new Title Format setting volition appear, where you lot can define what the car-generated titles should look like.

The Championship Format is a full-blown Twig template, and it volition get parsed whenever your entries are saved.

The entry is passed to this template as a variable named object. You lot can reference the entry's properties (opens new window) in two ways:

  1. normal Twig syntax: {{ object.belongings }}
  2. shortcut Twig syntax: {belongings}

Shortcut syntax merely has 1 set of curly braces.

If Craft finds any of these in your Title Format, it volition replace the { with {{object. and the } with }}, before passing the template off to Twig for parsing.

You can apply Twig filters in both syntaxes:

Craft's global variables are available to these templates too:

Conditionals are likewise fair game. In that location's no shortcut syntax for those, and then if yous want to use a conditional on one of the entry's properties, y'all will demand to reference information technology with the object variable:

# Editing Entries

If you accept at to the lowest degree one section, at that place will be an Entries tab in the primary control console navigation. Clicking on it will take you to the entry alphabetize. From there you lot can navigate to the entry you lot wish to edit, or create a new one.

Y'all can perform the following actions from the Edit Entry page:

  • Choose the entry type (if there's at least two to choose from)
  • Edit the entry'due south title
  • Edit the entry's slug
  • Edit the entry'south custom field content
  • Cull the entry's author (Pro edition simply)
  • Choose the entry'due south parent (if it's within a Structure section)
  • Choose the entry's Post Date
  • Cull the entry'southward Expiration Date (optional)
  • Choose whether the entry is enabled or not
  • Salvage changes to the entry
  • Save a new draft of the entry
  • Publish a draft
  • View by versions of the entry

If y'all get out the Post Engagement blank, Arts and crafts will automatically set it the commencement fourth dimension an entry is saved equally enabled.

# Querying Entries

While an entry's configured template will automatically make an entry variable available, y'all can fetch entries throughout your templates or PHP lawmaking using entry queries.

  • Twig
  • PHP

Once you've created an entry query, yous can set parameters on it to narrow downward the results, and then execute it by calling .all(). An array of Entry (opens new window) objects volition exist returned.

# Example

We tin display the 10 most recent entries in a "Weblog" section past doing the following:

  1. Create an entry query with craft.entries().
  2. Prepare the department and limit parameters on information technology.
  3. Fetch the entries with .all().
  4. Loop through the entries using a for (opens new window) tag to output the blog post HTML.

# Parameters

Entry queries back up the post-obit parameters:

Param Description
subsequently Narrows the query results to only entries that were posted on or after a certain date.
afterPopulate Performs any mail-population processing on elements.
ancestorDist Narrows the query results to merely entries that are up to a certain distance away from the entry specified by ancestorOf.
ancestorOf Narrows the query results to simply entries that are ancestors of another entry in its structure.
andRelatedTo Narrows the query results to only entries that are related to certain other elements.
anyStatus Removes element filters based on their statuses.
asArray Causes the query to render matching entries every bit arrays of data, rather than Entry (opens new window) objects.
authorGroup Narrows the query results based on the user group the entries' authors belong to.
authorGroupId Narrows the query results based on the user group the entries' authors belong to, per the groups' IDs.
authorId Narrows the query results based on the entries' authors.
before Narrows the query results to only entries that were posted before a certain date.
cache Enables query cache for this Query.
clearCachedResult Clears the cached consequence (opens new window) .
dateCreated Narrows the query results based on the entries' creation dates.
dateUpdated Narrows the query results based on the entries' terminal-updated dates.
descendantDist Narrows the query results to but entries that are up to a certain distance away from the entry specified by descendantOf.
descendantOf Narrows the query results to but entries that are descendants of another entry in its structure.
draftCreator Narrows the query results to but drafts created by a given user.
draftId Narrows the query results based on the entries' draft'southward ID (from the drafts tabular array).
draftOf Narrows the query results to only drafts of a given entry.
drafts Narrows the query results to only drafts entries.
expiryDate Narrows the query results based on the entries' decease dates.
fixedOrder Causes the query results to be returned in the order specified past id.
hasDescendants Narrows the query results based on whether the entries take whatever descendants in their structure.
id Narrows the query results based on the entries' IDs.
ignorePlaceholders Causes the query to return matching entries as they are stored in the database, ignoring matching placeholder elements that were set by craft\services\Elements::setPlaceholderElement() (opens new window) .
inReverse Causes the query results to exist returned in reverse order.
leaves Narrows the query results based on whether the entries are "leaves" (entries with no descendants).
level Narrows the query results based on the entries' level within the structure.
limit Determines the number of entries that should be returned.
nextSiblingOf Narrows the query results to only the entry that comes immediately afterward some other entry in its structure.
starting time Determines how many entries should exist skipped in the results.
orderBy Determines the order that the entries should be returned in. (If empty, defaults to postDate DESC, or the order defined by the section if the section or sectionId params are set to a unmarried Structure section.)
positionedAfter Narrows the query results to only entries that are positioned after another entry in its structure.
positionedBefore Narrows the query results to but entries that are positioned before another entry in its structure.
postDate Narrows the query results based on the entries' post dates.
preferSites If unique is set, this determines which site should be selected when querying multi-site elements.
prevSiblingOf Narrows the query results to just the entry that comes immediately before some other entry in its structure.
provisionalDrafts Narrows the query results to just provisional drafts.
relatedTo Narrows the query results to only entries that are related to sure other elements.
revisionCreator Narrows the query results to simply revisions created past a given user.
revisionId Narrows the query results based on the entries' revision'due south ID (from the revisions table).
revisionOf Narrows the query results to only revisions of a given entry.
revisions Narrows the query results to just revision entries.
savedDraftsOnly Narrows the query results to merely unpublished drafts which have been saved after initial creation.
search Narrows the query results to only entries that friction match a search query.
section Narrows the query results based on the sections the entries vest to.
sectionId Narrows the query results based on the sections the entries belong to, per the sections' IDs.
siblingOf Narrows the query results to only entries that are siblings of another entry in its construction.
site Determines which site(south) the entries should be queried in.
siteId Determines which site(s) the entries should exist queried in, per the site's ID.
siteSettingsId Narrows the query results based on the entries' IDs in the elements_sites tabular array.
slug Narrows the query results based on the entries' slugs.
status Narrows the query results based on the entries' statuses.
title Narrows the query results based on the entries' titles.
trashed Narrows the query results to but entries that have been soft-deleted.
type Narrows the query results based on the entries' entry types.
typeId Narrows the query results based on the entries' entry types, per the types' IDs.
uid Narrows the query results based on the entries' UIDs.
unique Determines whether only elements with unique IDs should exist returned past the query.
uri Narrows the query results based on the entries' URIs.
with Causes the query to render matching entries eager-loaded with related elements.

# later on

Narrows the query results to only entries that were posted on or after a sure appointment.

Possible values include:

Value Fetches entries…
'2018-04-01' that were posted afterwards 2018-04-01.
a DateTime (opens new window) object that were posted after the date represented by the object.
  • Twig
  • PHP

# afterPopulate

Performs any post-population processing on elements.

# ancestorDist

Narrows the query results to only entries that are up to a certain distance abroad from the entry specified by ancestorOf.

  • Twig
  • PHP

# ancestorOf

Narrows the query results to only entries that are ancestors of another entry in its structure.

Possible values include:

Value Fetches entries…
1 to a higher place the entry with an ID of i.
a Entry (opens new window) object above the entry represented by the object.
  • Twig
  • PHP

This tin be combined with ancestorDist if you want to limit how far away the ancestor entries can be.

# andRelatedTo

Narrows the query results to only entries that are related to certain other elements.

See Relations (opens new window) for a full explanation of how to work with this parameter.

  • Twig
  • PHP

# anyStatus

Removes element filters based on their statuses.

  • Twig
  • PHP

# asArray

Causes the query to return matching entries as arrays of data, rather than Entry (opens new window) objects.

  • Twig
  • PHP

Narrows the query results based on the user group the entries' authors vest to.

Possible values include:

Value Fetches entries…
'foo' with an author in a grouping with a handle of foo.
'not foo' not with an author in a group with a handle of foo.
['foo', 'bar'] with an author in a group with a handle of foo or bar.
['non', 'foo', 'bar'] non with an author in a group with a handle of foo or bar.
a UserGroup (opens new window) object with an author in a group represented by the object.
  • Twig
  • PHP

# authorGroupId

Narrows the query results based on the user grouping the entries' authors vest to, per the groups' IDs.

Possible values include:

Value Fetches entries…
1 with an writer in a group with an ID of 1.
'non 1' non with an author in a group with an ID of one.
[1, ii] with an writer in a group with an ID of 1 or 2.
['not', ane, 2] non with an author in a grouping with an ID of 1 or two.
  • Twig
  • PHP

# authorId

Narrows the query results based on the entries' authors.

Possible values include:

Value Fetches entries…
ane with an author with an ID of 1.
'not 1' not with an author with an ID of 1.
[one, 2] with an author with an ID of i or 2.
['not', one, ii] not with an author with an ID of ane or two.
  • Twig
  • PHP

# before

Narrows the query results to simply entries that were posted before a certain date.

Possible values include:

Value Fetches entries…
'2018-04-01' that were posted before 2018-04-01.
a DateTime (opens new window) object that were posted before the date represented past the object.
  • Twig
  • PHP

# cache

Enables query enshroud for this Query.

# clearCachedResult

Clears the cached issue (opens new window) .

# dateCreated

Narrows the query results based on the entries' creation dates.

Possible values include:

Value Fetches entries…
'>= 2018-04-01' that were created on or after 2018-04-01.
'< 2018-05-01' that were created before 2018-05-01
['and', '>= 2018-04-04', '< 2018-05-01'] that were created between 2018-04-01 and 2018-05-01.
  • Twig
  • PHP

# dateUpdated

Narrows the query results based on the entries' last-updated dates.

Possible values include:

Value Fetches entries…
'>= 2018-04-01' that were updated on or later 2018-04-01.
'< 2018-05-01' that were updated earlier 2018-05-01
['and', '>= 2018-04-04', '< 2018-05-01'] that were updated betwixt 2018-04-01 and 2018-05-01.
  • Twig
  • PHP

# descendantDist

Narrows the query results to just entries that are up to a certain distance away from the entry specified by descendantOf.

  • Twig
  • PHP

# descendantOf

Narrows the query results to simply entries that are descendants of another entry in its structure.

Possible values include:

Value Fetches entries…
1 below the entry with an ID of 1.
a Entry (opens new window) object beneath the entry represented past the object.
  • Twig
  • PHP

This can be combined with descendantDist if y'all desire to limit how far away the descendant entries tin be.

# draftCreator

Narrows the query results to just drafts created by a given user.

Possible values include:

  • Twig
  • PHP

# draftId

Narrows the query results based on the entries' draft'south ID (from the drafts tabular array).

Possible values include:

Value Fetches drafts…
1 for the draft with an ID of ane.
  • Twig
  • PHP

# draftOf

Narrows the query results to simply drafts of a given entry.

Possible values include:

Value Fetches drafts…
i for the entry with an ID of 1.
a Entry (opens new window) object for the entry represented past the object.
'*' for any entry
false that aren't associated with a published entry
  • Twig
  • PHP

# drafts

Narrows the query results to only drafts entries.

  • Twig
  • PHP

# expiryDate

Narrows the query results based on the entries' decease dates.

Possible values include:

Value Fetches entries…
':empty:' that don't have an decease date.
':notempty:' that have an expiry date.
'>= 2020-04-01' that will expire on or later on 2020-04-01.
'< 2020-05-01' that will expire before 2020-05-01
['and', '>= 2020-04-04', '< 2020-05-01'] that will expire betwixt 2020-04-01 and 2020-05-01.
  • Twig
  • PHP

# fixedOrder

Causes the query results to exist returned in the order specified by id.

If no IDs were passed to id, setting this to truthful will consequence in an empty result set.

  • Twig
  • PHP

# hasDescendants

Narrows the query results based on whether the entries have whatsoever descendants in their structure.

(This has the opposite effect of calling leaves.)

  • Twig
  • PHP

# id

Narrows the query results based on the entries' IDs.

Possible values include:

Value Fetches entries…
1 with an ID of one.
'not one' non with an ID of 1.
[1, two] with an ID of 1 or ii.
['non', 1, 2] non with an ID of 1 or 2.
  • Twig
  • PHP

This can be combined with fixedOrder if you want the results to be returned in a specific order.

# ignorePlaceholders

Causes the query to return matching entries as they are stored in the database, ignoring matching placeholder elements that were set by arts and crafts\services\Elements::setPlaceholderElement() (opens new window) .

# inReverse

Causes the query results to exist returned in reverse social club.

  • Twig
  • PHP

# leaves

Narrows the query results based on whether the entries are "leaves" (entries with no descendants).

(This has the opposite issue of calling hasDescendants.)

  • Twig
  • PHP

# level

Narrows the query results based on the entries' level within the structure.

Possible values include:

Value Fetches entries…
1 with a level of 1.
'not 1' not with a level of 1.
'>= iii' with a level greater than or equal to iii.
[1, ii] with a level of ane or ii
['not', 1, two] not with level of 1 or ii.
  • Twig
  • PHP

# limit

Determines the number of entries that should be returned.

  • Twig
  • PHP

# nextSiblingOf

Narrows the query results to only the entry that comes immediately afterwards another entry in its construction.

Possible values include:

Value Fetches the entry…
i after the entry with an ID of 1.
a Entry (opens new window) object subsequently the entry represented by the object.
  • Twig
  • PHP

# offset

Determines how many entries should be skipped in the results.

  • Twig
  • PHP

# orderBy

Determines the lodge that the entries should be returned in. (If empty, defaults to postDate DESC, or the guild divers by the section if the section or sectionId params are gear up to a unmarried Structure department.)

  • Twig
  • PHP

# positionedAfter

Narrows the query results to only entries that are positioned later on another entry in its structure.

Possible values include:

Value Fetches entries…
ane after the entry with an ID of 1.
a Entry (opens new window) object after the entry represented by the object.
  • Twig
  • PHP

# positionedBefore

Narrows the query results to merely entries that are positioned before some other entry in its structure.

Possible values include:

Value Fetches entries…
1 before the entry with an ID of 1.
a Entry (opens new window) object before the entry represented by the object.
  • Twig
  • PHP

# postDate

Narrows the query results based on the entries' mail dates.

Possible values include:

Value Fetches entries…
'>= 2018-04-01' that were posted on or after 2018-04-01.
'< 2018-05-01' that were posted before 2018-05-01
['and', '>= 2018-04-04', '< 2018-05-01'] that were posted between 2018-04-01 and 2018-05-01.
  • Twig
  • PHP

# preferSites

If unique is set, this determines which site should be selected when querying multi-site elements.

For instance, if element "Foo" exists in Site A and Site B, and element "Bar" exists in Site B and Site C, and this is set to ['c', 'b', 'a'], then Foo will be returned for Site B, and Bar will be returned for Site C.

If this isn't set, then preference goes to the current site.

  • Twig
  • PHP

# prevSiblingOf

Narrows the query results to only the entry that comes immediately before another entry in its structure.

Possible values include:

Value Fetches the entry…
one before the entry with an ID of i.
a Entry (opens new window) object earlier the entry represented by the object.
  • Twig
  • PHP

# provisionalDrafts

Narrows the query results to only conditional drafts.

  • Twig
  • PHP

Narrows the query results to just entries that are related to certain other elements.

See Relations (opens new window) for a full explanation of how to work with this parameter.

  • Twig
  • PHP

# revisionCreator

Narrows the query results to only revisions created by a given user.

Possible values include:

  • Twig
  • PHP

# revisionId

Narrows the query results based on the entries' revision'due south ID (from the revisions tabular array).

Possible values include:

Value Fetches revisions…
1 for the revision with an ID of one.
  • Twig
  • PHP

# revisionOf

Narrows the query results to merely revisions of a given entry.

Possible values include:

Value Fetches revisions…
1 for the entry with an ID of one.
a Entry (opens new window) object for the entry represented past the object.
  • Twig
  • PHP

# revisions

Narrows the query results to only revision entries.

  • Twig
  • PHP

# savedDraftsOnly

Narrows the query results to only unpublished drafts which have been saved afterwards initial cosmos.

  • Twig
  • PHP

Narrows the query results to just entries that match a search query.

Run into Searching (opens new window) for a total explanation of how to work with this parameter.

  • Twig
  • PHP

# section

Narrows the query results based on the sections the entries belong to.

Possible values include:

Value Fetches entries…
'foo' in a section with a handle of foo.
'not foo' not in a section with a handle of foo.
['foo', 'bar'] in a section with a handle of foo or bar.
['not', 'foo', 'bar'] not in a section with a handle of foo or bar.
a Section (opens new window) object in a section represented past the object.
  • Twig
  • PHP

# sectionId

Narrows the query results based on the sections the entries belong to, per the sections' IDs.

Possible values include:

Value Fetches entries…
1 in a section with an ID of 1.
'not 1' not in a section with an ID of ane.
[i, two] in a section with an ID of ane or ii.
['not', ane, 2] not in a department with an ID of ane or 2.
  • Twig
  • PHP

# siblingOf

Narrows the query results to only entries that are siblings of another entry in its structure.

Possible values include:

Value Fetches entries…
1 abreast the entry with an ID of 1.
a Entry (opens new window) object beside the entry represented past the object.
  • Twig
  • PHP

# site

Determines which site(s) the entries should exist queried in.

The current site will exist used by default.

Possible values include:

Value Fetches entries…
'foo' from the site with a handle of foo.
['foo', 'bar'] from a site with a handle of foo or bar.
['not', 'foo', 'bar'] not in a site with a handle of foo or bar.
a craft\models\Site (opens new window) object from the site represented past the object.
'*' from whatsoever site.

If multiple sites are specified, elements that vest to multiple sites will exist returned multiple times. If you lot only want unique elements to be returned, use unique in conjunction with this.

  • Twig
  • PHP

# siteId

Determines which site(s) the entries should exist queried in, per the site'south ID.

The current site will exist used by default.

Possible values include:

Value Fetches entries…
ane from the site with an ID of one.
[one, 2] from a site with an ID of one or 2.
['not', 1, 2] not in a site with an ID of 1 or 2.
'*' from whatever site.
  • Twig
  • PHP

# siteSettingsId

Narrows the query results based on the entries' IDs in the elements_sites table.

Possible values include:

Value Fetches entries…
1 with an elements_sites ID of 1.
'not ane' not with an elements_sites ID of 1.
[1, 2] with an elements_sites ID of i or ii.
['non', 1, 2] non with an elements_sites ID of i or 2.
  • Twig
  • PHP

# slug

Narrows the query results based on the entries' slugs.

Possible values include:

Value Fetches entries…
'foo' with a slug of foo.
'foo*' with a slug that begins with foo.
'*foo' with a slug that ends with foo.
'*foo*' with a slug that contains foo.
'not *foo*' with a slug that doesn't incorporate foo.
['*foo*', '*bar*'] with a slug that contains foo or bar.
['not', '*foo*', '*bar*'] with a slug that doesn't contain foo or bar.
  • Twig
  • PHP

# condition

Narrows the query results based on the entries' statuses.

Possible values include:

Value Fetches entries…
'live' (default) that are live.
'pending' that are awaiting (enabled with a Post Date in the future).
'expired' that are expired (enabled with an Expiry Date in the past).
'disabled' that are disabled.
['live', 'awaiting'] that are live or pending.
['not', 'alive', 'awaiting'] that are not live or pending.
  • Twig
  • PHP

# title

Narrows the query results based on the entries' titles.

Possible values include:

Value Fetches entries…
'Foo' with a title of Foo.
'Foo*' with a title that begins with Foo.
'*Foo' with a championship that ends with Foo.
'*Foo*' with a championship that contains Foo.
'not *Foo*' with a title that doesn't contain Foo.
['*Foo*', '*Bar*'] with a title that contains Foo or Bar.
['not', '*Foo*', '*Bar*'] with a championship that doesn't contain Foo or Bar.
  • Twig
  • PHP

# trashed

Narrows the query results to but entries that have been soft-deleted.

  • Twig
  • PHP

# type

Narrows the query results based on the entries' entry types.

Possible values include:

Value Fetches entries…
'foo' of a type with a handle of foo.
'not foo' non of a type with a handle of foo.
['foo', 'bar'] of a type with a handle of foo or bar.
['not', 'foo', 'bar'] not of a type with a handle of foo or bar.
an EntryType (opens new window) object of a type represented by the object.
  • Twig
  • PHP

# typeId

Narrows the query results based on the entries' entry types, per the types' IDs.

Possible values include:

Value Fetches entries…
1 of a type with an ID of 1.
'not 1' not of a type with an ID of 1.
[1, 2] of a blazon with an ID of 1 or 2.
['not', 1, 2] not of a type with an ID of i or ii.
  • Twig
  • PHP

# uid

Narrows the query results based on the entries' UIDs.

  • Twig
  • PHP

# unique

Determines whether only elements with unique IDs should exist returned by the query.

This should be used when querying elements from multiple sites at the same time, if "duplicate" results is not desired.

  • Twig
  • PHP

# uri

Narrows the query results based on the entries' URIs.

Possible values include:

Value Fetches entries…
'foo' with a URI of foo.
'foo*' with a URI that begins with foo.
'*foo' with a URI that ends with foo.
'*foo*' with a URI that contains foo.
'not *foo*' with a URI that doesn't incorporate foo.
['*foo*', '*bar*'] with a URI that contains foo or bar.
['non', '*foo*', '*bar*'] with a URI that doesn't contain foo or bar.
  • Twig
  • PHP

# with

Causes the query to render matching entries eager-loaded with related elements.

See Eager-Loading Elements (opens new window) for a total explanation of how to piece of work with this parameter.

  • Twig
  • PHP

smithater1983.blogspot.com

Source: https://craftcms.com/docs/3.x/entries.html

Post a Comment for "Guest Entries Upload New Asset Craft Cms"