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:
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:
For instance, the |
[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. |
[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. |
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:
|
MM |
A numeric representation of a month or a relative month. Examples:
|
DD |
A numeric representation of a day or a relative day. Examples:
|
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. |
Go to Posts » Post Settings and click on the Advanced tab within the Single Post Settings box.
Add the following selector to the selectors: [category=tech]
Finally, enable the Header option below and select the header you want to display.
Remember to click "Save Changes".
Go to Posts » Post Settings and click on the Advanced tab within the Single Post Settings box.
Add the following selector to the selectors: [format=video]
Finally, enable the Sidebar Position option below and select the "none" value.
Remember to click "Save Changes".
Go to Posts » Post Settings and click on the Advanced tab within the Single Post Settings box.
Add the following selector to the selectors: .external
Finally, enable the Post Template option below and select the post template you want to use.
Remember to click "Save Changes".
Go to Pages » Page Settings and click on the Advanced tab within the Page Settings box.
Add the following selector to the selectors: .external
Finally, enable the Header option below and select the header you want to display.
Remember to click "Save Changes".
Go to Pages, edit your Blog page and click on the Advanced tab in the "Post Layout" section within the Blog Page Options box.
Add the following selector to the selectors: [format=video]
Finally, enable the Post Template option below and select the post template you want to use for video posts.
Remember to click "Save Changes".
Go to Theme Options » General » Search and click on the Advanced tab in the Post Layout section.
Add the following selector to the selectors: page
Finally, enable the Meta Info option below and select the meta data you want to display for pages in the search result list.
Remember to click "Save Changes".
The Media Width and Media Height options in the Slide Settings section of the slideshow allow you to set the size of post thumbnails.
Additionally, you can use selectors for these settings. Just click on the Advanced tab and add the following selector to the selectors: [category=tech]
Then specify the thumbnail size for the posts from the "tech" category with the Media Width and Media Height options for the selector.
You should add a unique CSS class to the "large" images (CSS Class option on the Edit Media screen).
For instance "large".
Now specify the size of your "small" images with the Media Width and Media Height options in the Slide Settings section of the slideshow.
Then click on the Advanced tab, and add the following selector to the selectors: .large
Finally, specify the size of your "large" images with the Media Width and Media Height options for the selector.
Set the Media Width and Media Height options in the Slide Settings section of the slideshow to 200x100.
Then click on the Advanced tab, and add the following selector to the selectors: media
Finally, set the Media Width and Media Height options for the selector to 300x150.
You should add a unique CSS class to the "large" images (CSS Class option on the Edit Media screen).
For instance "large".
Now set the Media Width and Media Height options in the Slide Settings section of the slideshow to 200x100.
Then click on the Advanced tab, and add the following selector to the selectors:
post[category=tech]
media
media.large