{"id":42999,"date":"2016-04-06T00:01:12","date_gmt":"2016-04-06T00:01:12","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/administrative-shortcodes\/"},"modified":"2021-05-11T19:59:17","modified_gmt":"2021-05-11T19:59:17","slug":"administrative-shortcodes","status":"closed","type":"plugin","link":"https:\/\/et.wordpress.org\/plugins\/administrative-shortcodes\/","author":4801455,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"0.3.4","stable_tag":"trunk","tested":"5.7.15","requires":"3.1","requires_php":"","requires_plugins":"","header_name":"Administrative Shortcodes","header_author":"Hassan Derakhshandeh","header_description":"","assets_banners_color":"","last_updated":"2021-05-11 19:59:17","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"","rating":0,"author_block_rating":0,"active_installs":10,"downloads":2299,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation"],"tags":[],"upgrade_notice":[],"ratings":{"1":0,"2":0,"3":0,"4":0,"5":0},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":[]},"plugin_section":[],"plugin_tags":[1214,2681,662,80,2255],"plugin_category":[40,43,51],"plugin_contributors":[78384],"plugin_business_model":[],"class_list":["post-42999","plugin","type-plugin","status-closed","hentry","plugin_tags-code","plugin_tags-context","plugin_tags-php","plugin_tags-shortcode","plugin_tags-wpmu","plugin_category-calendar-and-events","plugin_category-customization","plugin_category-multisite","plugin_contributors-shazdeh","plugin_committers-shazdeh"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/administrative-shortcodes.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>A set of shortcodes for the website administrators.<\/p>\n\n<h4>if<\/h4>\n\n<p>Using this shortcode you can limit the display of the text or shortcodes to specific page(s) on your website. You can use all the <a href=\"http:\/\/codex.wordpress.org\/Conditional_Tags\">conditional tags<\/a> WordPress provides. Checkout examples below.<\/p>\n\n<p>Show text only on the homepage:<\/p>\n\n<pre><code>[if is_front_page] The text [\/if]\n<\/code><\/pre>\n\n<p>Show text only on the About page of the site:<\/p>\n\n<pre><code>[if is_page=\"about\"] The text [\/if]\n<\/code><\/pre>\n\n<p>Show only on the category archive view:<\/p>\n\n<pre><code>[if is_category] The text [\/if]\n<\/code><\/pre>\n\n<p>You can add \"not_\" before the conditional tag to reverse the logic, example:\nShow on all pages of the site except the homepage:<\/p>\n\n<pre><code>[if not_is_front_page] The text [\/if]\n<\/code><\/pre>\n\n<p>Using multiple parameters, the content is displayed when either of the conditions are met (\"OR\" comparison), for example, show text on both category and tag archive pages:<\/p>\n\n<pre><code>[if is_category is_tag] The text [\/if]\n<\/code><\/pre>\n\n<p>To set multiple conditions you can nest the shortcode, for example show text only on homepage AND if the user is logged in:<\/p>\n\n<pre><code>[if is_user_logged_in][if is_front_page] The text [\/if][\/if]\n<\/code><\/pre>\n\n<p>Show a link to wordpress.org site, only on single post pages and only on mobile devices:<\/p>\n\n<pre><code>[if wp_is_mobile][if is_single] &lt;a href=\"http:\/\/wordpress.org\/\"&gt;WordPress&lt;\/a&gt; [\/if][\/if]\n<\/code><\/pre>\n\n<h4>switch_to_blog<\/h4>\n\n<p>Run shortcodes in the context of another website in the network. This shortcode is only available in multisite installations (WP Network). For example, list posts from another blog:<\/p>\n\n<pre><code>[switch_to_blog id=\"10\"] [list_posts limit=\"10\"] [\/switch_to_blog]\n<\/code><\/pre>\n\n<h4>iterator<\/h4>\n\n<p>Display text or shortcodes only if repeated a certain number of times. Requires an \"id\" parameter which should be unique for that shortcode (can be anything you want).<\/p>\n\n<pre><code>[iterator id=\"my-ads\" repeat=\"5\"] My ad codes [\/iterator]\n<\/code><\/pre>\n\n<p>After every 5th call to that shortcode, render the output.<\/p>\n\n<h4>get_template<\/h4>\n\n<p>Load a template file into the page. The referenced file is loaded from child theme if it exists, if not from the parent theme. Example, load includes\/slider.php template file from the theme:<\/p>\n\n<pre><code>[get_template slug=\"includes\/slider\"]\n<\/code><\/pre>\n\n<h4>scheduler<\/h4>\n\n<p>Show text or shortcodes only if the specified date has passed. Example, show the text only if it's after Christmas of 2016:<\/p>\n\n<pre><code>[scheduler date=\"December 25, 2016\"] Text [\/scheduler]\n<\/code><\/pre>\n\n<h4>date<\/h4>\n\n<p>Shows the current date or time in the specified format (http:\/\/codex.wordpress.org\/Formatting_Date_and_Time). Uses Date Format (in Settings &gt; General) by default.<\/p>\n\n<pre><code>[date format=\"F j, Y\"]\n<\/code><\/pre>\n\n<h4>loginoutlink<\/h4>\n\n<p>Display a link to login page if user is not logged-in, or a logout page if they are. Parameters:<\/p>\n\n<ul>\n<li>login : \"Log in\" text<\/li>\n<li>logout : \"Log out\" text<\/li>\n<li>redirect : optional URL to redirect to on login or logout<\/li>\n<\/ul>\n\n<h4>login_form<\/h4>\n\n<p>Display the login form.<\/p>\n\n<h4>custom_field<\/h4>\n\n<p>Display a custom field from a post. Parameters:<\/p>\n\n<ul>\n<li>key : name of the custom field to show. This parameter is required.<\/li>\n<li>post_id : the ID of the post to display the custom field from; by default uses the current post in the loop<\/li>\n<li>before : show a text to display before the value of the field<\/li>\n<li>after : show a text after the value of the field<\/li>\n<\/ul>\n\n<h4>disable<\/h4>\n\n<p>Wrap any content or shortcode with <code>[disable]<\/code> shortcode to prevent that piece of content from being rendered. Perfect for debugging shortcodes.<\/p>\n\n<h4>the_id<\/h4>\n\n<p>Shows the current post ID; useful when you need to debug WP Loops.<\/p>\n\n<h4>Path shortcodes<\/h4>\n\n<p>[home_url] : returns the homepage URL\n[get_template_directory] : Absolute path to the parent theme directory\n[get_template_directory_uri] : URL to the directory of the parent theme\n[get_stylesheet_directory] : Absolute path to the directory of the child theme\n[get_stylesheet_directory_uri] : URL to the directory of the child theme<\/p>\n\n<h4>rand shortcodes<\/h4>\n\n<p>Show a random number between two numbers. Parameters:\n* min : minimum value (default 0)\n* max : maximum value (default 100)<\/p>\n\n<h4>get_var<\/h4>\n\n<p>Retrieve a value from $_GET or $_POST variables.\nTo get a URL query string:<\/p>\n\n<pre><code>[get_var get=\"myvar\"]\n<\/code><\/pre>\n\n<p>To get a value from POST:<\/p>\n\n<pre><code>[get_var post=\"myvar\"]\n<\/code><\/pre>\n\n<!--section=installation-->\n<ol>\n<li>Upload the the plugin directory to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<li>Enjoy!<\/li>\n<\/ol>","raw_excerpt":"A set of shortcodes for the website administrators.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/42999","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=42999"}],"author":[{"embeddable":true,"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/shazdeh"}],"wp:attachment":[{"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=42999"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=42999"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=42999"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=42999"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=42999"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/et.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=42999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}