|
1 |
| -# Redux Shortcodes |
| 1 | +# Shortcodes <Badge text="enhancement" type="warn"/> |
| 2 | + |
| 3 | +Redux comes complete with a set of useful shortcodes for use in your theme or plugin. |
| 4 | + |
| 5 | +::: warning |
| 6 | +Shortcode results will not appear in your option panel or on the backend due to Redux config loading on or before the `init` hook (if doing it properly. |
| 7 | + |
| 8 | +However, using these shortcodes within input boxes where the result is displayed on the front end will work. |
| 9 | +::: |
| 10 | + |
| 11 | +## Shortcodes |
| 12 | +| Shortcode | Function| Output | |
| 13 | +|------------|---------|--------| |
| 14 | +|[bloginfo data="name"]|get_bloginfo("name")|Displays the "Site Title" set in Settings > General. This data is retrieved from the "blogname" record in the wp_options table.| |
| 15 | +|[bloginfo data="description"]|get_bloginfo("description")|Displays the "Tagline" set in Settings > General. This data is retrieved from the "blogdescription" record in the wp_options table.| |
| 16 | +|[bloginfo data="wpurl"]|get_bloginfo("wpurl")|Displays the "WordPress address (URL)" set in Settings > General. This data is retrieved from the "siteurl" record in the wp_options table. Consider using *root_url* instead, especially for multi-site configurations using paths instead of subdomains (it will return the root site not the current sub-site).| |
| 17 | +|[bloginfo data="root_url"]|site_url()|Return the root site, not the current sub-site.| |
| 18 | +|[bloginfo data="url"]|home_url()|Displays the "Site address (URL)" set in Settings > General. This data is retrieved from the "home" record in the wp_options table.| |
| 19 | +|[bloginfo data="admin_email"]|get_bloginfo("admin_email")|Displays the "E-mail address" set in Settings > General. This data is retrieved from the "admin_email" record in the wp_options table.| |
| 20 | +|[bloginfo data="charset"]|get_bloginfo("charset")|Displays the "Encoding for pages and feeds" set in Settings > Reading. This data is retrieved from the "blog_charset" record in the wp_options.| |
| 21 | +|[bloginfo data="version"]|get_bloginfo("version")|Displays the WordPress Version you use. This data is retrieved from the $wp_version variable set in wp-includes/version.php.| |
| 22 | +|[bloginfo data="html_type"]|get_bloginfo("html_type")|Displays the Content-Type of WordPress HTML pages (default: "text/html"). This data is retrieved from the "html_type" record in the wp_options table. Themes and plugins can override the default value using the pre_option_html_type filter.| |
| 23 | +|[bloginfo data="is_multisite"]|is_multisite()|Displays true/false check if WordPress is running in multisite mode.| |
| 24 | +|[bloginfo data="text_direction"]|is_rtl()|Displays true/false check if the Text Direction of WordPress HTML pages is left instead of right.| |
| 25 | +|[bloginfo data="language"]|get_bloginfo("language")|Displays the language of WordPress.| |
| 26 | +|[bloginfo data="stylesheet_url"]|get_stylesheet_uri()|Displays the primary CSS (usually style.css) file URL of the active theme.| |
| 27 | +|[bloginfo data="stylesheet_directory"]|get_stylesheet_directory()|Displays the stylesheet directory of the active theme.| |
| 28 | +|[bloginfo data="template_url"]|get_template_directory_uri()|Displays the "Site Title" set in Settings > General. This data is retrieved from the "blogname" record in the wp_options table.| |
| 29 | +|[bloginfo data="child_template_url"]|get_stylesheet_directory_uri()|Child template URI.| |
| 30 | +|[bloginfo data="template_directory"]|get_template_directory()|Template directory.| |
| 31 | +|[bloginfo data="child_template_directory"]|get_stylesheet_directory()|Child template Directory.| |
| 32 | +|[bloginfo data="pingback_url"]|get_bloginfo("pingback_url")|Displays the Pingback XML-RPC file URL (xmlrpc.php).| |
| 33 | +|[bloginfo data="atom_url"]|get_bloginfo("atom_url")|Displays the Atom feed URL (/feed/atom).| |
| 34 | +|[bloginfo data="rdf_url"]|get_bloginfo("rdf_url")|Displays the RDF/RSS 1.0 feed URL (/feed/rfd).| |
| 35 | +|[bloginfo data="rss_url"]|get_bloginfo("rss_url")|Displays the RSS 0.92 feed URL (/feed/rss).| |
| 36 | +|[bloginfo data="rss2_url"]|get_bloginfo("rss2_url")|Displays the RSS 2.0 feed URL (/feed).| |
| 37 | +|[bloginfo data="comments_atom_url"]|get_bloginfo("comments_atom_url")|Displays the comments Atom feed URL (/comments/feed).| |
| 38 | +|[bloginfo data="comments_rss2_url"]|get_bloginfo("comments_rss2_url")|Displays the comments RSS 2.0 feed URL (/comments/feed).| |
| 39 | +|[bloginfo data="login_url"]|wp_login_url()|Returns the WordPress login URL.| |
| 40 | +|[bloginfo data="logout_url"]|wp_logout_url()|Returns the WordPress logout URL.| |
| 41 | +|[bloginfo data="register_url"]|wp_registration_url()|Returns the WordPress register URL.| |
| 42 | +|[bloginfo data="lost_password_url"]|wp_lostpassword_url()|Returns the WordPress lost password URL.| |
| 43 | +|[date data="Y"]|date("Y")|Returns the current year. Any date format characters as specified by the PHP Date Format Table may be used.| |
| 44 | +|[themeinfo data="name"]|$theme_info->get("Name")|Theme name as given in theme's style.css.| |
| 45 | +|[themeinfo data="theme_uri"]|$theme_info->get("ThemeURI")|The URL to the theme's directory.| |
| 46 | +|[themeinfo data="description"]|$theme_info->get("Description")|The description of the theme.| |
| 47 | +|[themeinfo data="author"]|$theme_info->get("Author")|The theme's author.| |
| 48 | +|[themeinfo data="author_uri"]|$theme_info->get("AuthorURI")|The website of the theme author.| |
| 49 | +|[themeinfo data="version"]|$theme_info->get("Version")|The version of the theme.| |
| 50 | +|[themeinfo data="template"]|$theme_info->get("Template")|The folder name of the current theme.| |
| 51 | +|[themeinfo data="status"]|$theme_info->get("Status")|If the theme is published.| |
| 52 | +|[themeinfo data="tags"]|$theme_info->get("Tags")|Tags used to describe the theme.| |
| 53 | +|[themeinfo data="text_domain"]|$theme_info->get("TextDomain")|The text domain used in the theme for translation purposes.| |
| 54 | +|[themeinfo data="domain_path"]|$theme_info->get("DomainPath")|Path to the theme translation files.| |
| 55 | +|[themeinfo data="is_child"]|is_child_theme()|True/False return for child theme active check (Blank indicates False).| |
| 56 | + |
| 57 | +## Usage |
| 58 | +For shortcode output to display properly, any usage of these, or any, shortcodes must be run through WordPress's `do_shortcode` function. |
| 59 | + |
| 60 | +```php |
| 61 | +echo do_shortcode( '©' . [date data="Y"] . 'Company name | All Rights Reserved.' ); |
| 62 | +``` |
0 commit comments