Dottoro Theme Documentation

Tutorial to get your theme to work

PrologueFirst StepsFront PageCreating a custom front pageBlog, News and Portfolio post typesPost Type specific settingsGeneral settingsSingle post settingsCategory / Tag / Date archive page settingsPermalink settingsOptions on single post pagesGeneral page optionsImage optionsGallery settingsPage Templates and PagesPage SettingsPage TemplatesPages created from page templatesGeneral page settingsGallery settingsBlog page settingsNews page settingsPortfolio and Imagefolio page settingsContact page settingsArchives page settingsAuthors page settingsBoomarks page settingsSitemap page settingsSpecial pagesCategory and tag page settingsArchive and date page settingsSearch page settingsAuthor page settings404 page settingsHeader and MenuSubheadersSubheader specific shortcodesPredefined SubheadersCreating SubheadersAssigning subheaders to pagesFooterWidgets in the FooterCopyright and other notices in the FooterSidebarWidgets on the SidebarWidth and alignment of the sidebarWidget AreasWidgetsBreadcrumbShortcodesShortcodes In Alphabetical OrderShortcodes By CategoriesNested ShortcodesPost TemplatesOverlaysMedia and External MediaOverview of galleries, gallery listings and slideshowsGalleries and Gallery ListingsAbout Galleries In GeneralCreating And Managing Galleries[gallery_list] shortcodeSlideshows and Popup SlideshowsSlideshowsPopup SlideshowsSlideshow SettingsMost Often Used Slideshow OptionsAll Slideshow OptionsSlideshow Templates - Slideshow Specific ShortcodesStyling Guide For SlideshowsStyling Of Slideshow and Post TemplatesSlidesPopupsSelectorsWeb FontsGeneral Theme SettingsUser RolesExport / Import SettingsCreating theme designsLocalizationHeadingsChild ThemesCSS ClassesResponsive DesignCSS Extension JavaScript ToolkitJavaScript LibraryAction HooksFilter HooksCompatibility Issues
<

20. Selectors

If you don't feel like reading, see Real Life Examples below.

Selectors allow you to target posts, pages and media according to their attributes, such as CSS class, post type, post format, categories and tags. With the help of selectors you can specify individual settings for certain posts, pages and media. For instance, you can select individual header for posts from a certain category, you can display individual widgets in the sidebar for posts from a certain author, you can select different post templates for posts according to their post format, and so on.

There are lots of places where you can use selectors:

Selectors work the same way and with the same logic as CSS selectors.
Supported Selectors
page Applies to any page.
post Applies to any post (not page).
media Applies to any media.
You can add any number of media (self hosted media, external media and slide), posts and pages to a gallery in the Dottoro theme (more on Galleries). The media selector can be used to apply individual settings to list items or slides displaying media.
.className Applies to any post and page whose Body/Post CSS Class option contains className. The Body CSS Class option is used for single pages, while the Post CSS Class option is used if the post/page is displayed in a list or slideshow.

Additionally, you can use the CSS class selector for media also. You can assign CSS classes to each media with the CSS Class option on the Edit Media screen.

[type=postType] Applies to any post whose post type is postType.

Note: The post type of slides is dottoro_slide, the post type of external media is dottoro_media

[format=postFormat] Applies to any post whose post format is postFormat.
[author=authorName] Applies to any post whose author's user name is authorName.
[category=categoryName] Applies to any post from the category categoryName.
[tag=tagName] Applies to any post tagged as tagName.
[tax_taxName=termName] Applies to any post which has a term termName in the taxonomy of taxName. This is useful if you use a custom taxonomy for a post type and you want to filter posts by terms of this taxonomy.
[created=YY/MM/DD] Applies to any post that is created on the specified date. See Supported date formats for details.
[created_before=YY/MM/DD] Applies to any post that is created before the specified date. See Supported date formats for details.
[created_after=YY/MM/DD] Applies to any post that is created after the specified date. See Supported date formats for details.
[modified=YY/MM/DD] Applies to any post that is modified on the specified date. See Supported date formats for details.
[modified_before=YY/MM/DD] Applies to any post that is modified before the specified date. See Supported date formats for details.
[modified_after=YY/MM/DD] Applies to any post that is modified after the specified date. See Supported date formats for details.
[custom_fieldName=value] Applies to any post which has a custom field with a name of fieldName and its value is value.
[has=property] Supported properties:
  • media: applies to any media (self hosted media, external media and slide) and to any posts which has a thumbnail.
  • thumbnail: applies to any post and media which has a thumbnail.

For instance, the [has=thumbnail] selector can be useful if there are posts with and without thumbnail in a list/slideshow and you want to apply different excerpt lenghts to them.

Selectors can also be combined the same way as CSS selectors. Some examples:
[type=product].red Applies to any post whose post type is product and Body/Post CSS Class option contains red.
.red.blue Applies to any post, page and media whose Body/Post CSS Class option contains both red and blue.
page.red.blue Applies to any page whose Body/Post CSS Class option contains both red and blue.
.red, .blue Applies to any post, page and media whose Body/Post CSS Class option contains red or blue (or both).
page.red, media.blue Applies to any page whose Body/Post CSS Class option contains red and any media whose CSS Class option contains blue.
[format=video].red, page[author=john] Applies to any post whose post format is video and Body/Post CSS Class option contains red and applies to any page whose author is john.
The value of attribute selectors is optional:
[type] Applies to any post whose post type is not blog (post).
[format] Applies to any post which has a post format (not a standard post).
[author] Applies to any post which has an author (this does not make sense, every post and page has an author).
[category] Applies to any post which has at least one category.
[tag] Applies to any post which has at least one tag.
[tax_taxName] Applies to any post which has at least one term in the taxonomy of taxName.
[created]
[created_before]
[created_after]
[modified]
[modified_before]
[modified_after]
Applies to any post which has a creation/modification date (this does not make sense, every post and page has a creation/modification date).
[custom_fieldName] Applies to any post which has a custom field with a name of fieldName regardless of its value.
Supported date formats:

The [created], [created_before], [created_after], [modified], [modified_before] and [modified_after] attributes support the date in the following format: YY/MM/DD
Where:

YY A four digit representation of a year or a relative year.
Examples:
  • 2013 : the year of 2013
  • -1 : the last year
  • -2 : the year before the last year
  • -0 : the current year
  • 0 : the current year
The year is optional, if not specified there is no condition for the year. For details, please see the examples below.
MM A numeric representation of a month or a relative month.
Examples:
  • 1 : January
  • 01 : January
  • 4 : April
  • -1 : the last month
  • -2 : the month before the last month
  • -0 : the current month
  • 0 : the current month
The month is optional, if not specified there is no condition for the month. For details, please see the examples below.
DD A numeric representation of a day or a relative day.
Examples:
  • 1 : The first day in a month
  • 01 : The first day in a month
  • 4 : The fourth day in a month
  • -1 : the last day
  • -2 : the day before the last day
  • -0 : the current day
  • 0 : the current day
The day is optional, if not specified there is no condition for the day. For details, please see the examples below.
Examples for created (modified works the same way)
[created=2013] Applies to any post that is created in 2013.
[created=2013/05] Applies to any post that is created in May of 2013.
[created=2013/05/01] Applies to any post that is created on May 1, 2013.
[created=/05] Applies to any post that is created in May of any year.
[created=/05/01] Applies to any post that is created on May 1 in any year.
[created=//01] Applies to any post that is created on the first day in any month and in any year.
[created=-1] Applies to any post that is created in the last year.
[created=0] Applies to any post that is created in the current year.
[created=0/05] Applies to any post that is created in May of the current year.
[created=0/0] Applies to any post that is created in the current month.
[created=/0] Applies to any post that is created in the current month in any year.
Examples for created_before and created_after (modified_before and modified_after work the same way)
[created_before=2013] Applies to any post that is created before Jan 1, 2013.
[created_after=2013] Applies to any post that is created on or after Jan 1, 2013.
[created_before=2013/05] Applies to any post that is created before May 1, 2013.
[created_after=2013/05] Applies to any post that is created on or after May 1, 2013.
[created_before=2013/05/01] Applies to any post that is created before May 1, 2013.
[created_after=2013/05/01] Applies to any post that is created on or after May 1, 2013.
[created_before=/05] Applies to any post that is created before May 1 of any year.
[created_after=/05] Applies to any post that is created on or after May 1 of any year.
[created_before=//15] Applies to any post that is created before 15th of any month in any year.
[created_after=//15] Applies to any post that is created on or after 15th of any month in any year.
[created_before=-1] Applies to any post that is created before the last year.
[created_after=-1] Applies to any post that is created on or after Jan 1 of the last year.
[created_before=0] Applies to any post that is created before the current year.
[created_after=0] Applies to any post that is created in the current year.
[created_before=0/05] Applies to any post that is created before May 1 of the current year.
[created_after=0/05] Applies to any post that is created on or after May 1 of the current year.

Real life examples: