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

Do Action


Executes a hook action. This shortcode works the same as the WordPress do_action function.
Functions can be hooked on to an action with the add_action function. The [do_action] shortcode allows you to call the hooked PHP functions from anywhere where you can use shortcodes. So, you have the possibility to display dynamically generated content in posts and pages.

The 'action' attribute of the [do_action] shortcode is mandatory. It specifies the name of the hook to execute. Any other specified attributes will be passed as an array (key-value pairs) to the hooked functions as a first parameter.
If you paste the following lines into the functions.php file of your child theme (more on Child Themes):
add_action ('welcome_text', 'display_welcome_text');
function display_welcome_text () {
	echo ('Hi User!');
then anywhere where the
[do_action action="welcome_text" /]
shortcode is used, a 'Hi User!' text will appear.
Of course, not only plain text, but HTML can be displayed as well:
function display_welcome_text () {
	echo ('<h1 style="color: red;">Hi User!</h1>');

If you want, you can pass arguments to the hooked function. If the hooked function seems like this:

add_action ('welcome_text', 'display_welcome_text');
function display_welcome_text ($args) {
	$tag = isset ($args['tag']) ? $args['tag'] : 'h1';
	$color = isset ($args['color']) ? $args['color'] : 'red';

	echo ($tag .' style="color: '. $color .';">Hi User!');
then the
[do_action action="welcome_text" tag="h2" color="blue" /]
shortcode displays 'Hi User!' in blue and in a h2 heading element while, for example, the
[do_action action="welcome_text" tag="h1" color="green" /]
shortcode displays 'Hi User!' in green and in a h1 heading element.



Displays its content only if the given condition is true.
With the help of the meta_key and meta_value attributes, you can display some content depending on the value of a post meta (such as a custom field). If you need a more complex condition, use the 'function' attribute of the shortcode.

meta_key Specifies the key of the post meta whose value must be compared with the value given by meta_value. The [if] shortcode displays its content only if the two values are the same. If the meta_value attribute is not set, the content will be displayed only if the value of the post meta is true (casted to boolean).
meta_value Specifies a value that should be compared with the value of the meta key identified by the meta_key attribute.
condition Specifies the condition that must be satisfied. Available conditions are (nocase means not case sensitive):
exact matching.
'not' and 'not_equal' mean the same.
value of the post meta (starts/does not start) with meta_value
value of the post meta (ends/does not end) with meta_value
the value of the post meta is (greater/not greater/less/not less) than meta_value
value of the post meta (contains/does not contain) meta_value
Default is 'equal'.
function Specifies the comparison function. The content of the [if] shortcode will be displayed only if the comparison function returns true. Extra paramaters specified for the [if] shortcode will be passed as an array (key-value pairs) to the comparison function as a first parameter.
Example 1

This [if] shortcode only displays its content if the value of the 'my_field' custom field is 'show':

[if meta_key="my_field" meta_value="show"]Hello[/if]

Example 2

This [if] shortcode only displays its content if the post format is 'link':

[if function="show_on_link_format"]Visible in link post format[/if]
functions.php of your child theme:
function show_on_link_format () {	
	if ( has_post_format( 'link' ) ) {
		return true;
	return false;

Example 3

The first [if] shortcode only displays its content if the post format is 'link', the second one only if the post format is 'image'. The 'format' custom attribute will be passed to the filter_by_post_format method.

[if function="filter_by_post_format" format="link"]Visible in link post format[/if]
[if function="filter_by_post_format" format="image"]Visible in image post format[/if]
functions.php of your child theme:
function filter_by_post_format ($args) {	
	if ( has_post_format( $args['format'] ) ) {
		return true;
	return false;