Linux 软件免费装

Administrative Shortcodes

开发者 shazdeh
更新时间 2021年5月12日 03:59
PHP版本: 3.1 及以上
WordPress版本: 5.7.1

标签

shortcode php content date code wpmu context conditional conditional-tags loop schedule

下载

详情介绍:

A set of shortcodes for the website administrators. if 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 conditional tags WordPress provides. Checkout examples below. Show text only on the homepage: [if is_front_page] The text [/if] Show text only on the About page of the site: [if is_page="about"] The text [/if] Show only on the category archive view: [if is_category] The text [/if] You can add "not_" before the conditional tag to reverse the logic, example: Show on all pages of the site except the homepage: [if not_is_front_page] The text [/if] 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: [if is_category is_tag] The text [/if] To set multiple conditions you can nest the shortcode, for example show text only on homepage AND if the user is logged in: [if is_user_logged_in][if is_front_page] The text [/if][/if] Show a link to wordpress.org site, only on single post pages and only on mobile devices: [if wp_is_mobile][if is_single] WordPress [/if][/if] switch_to_blog 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: [switch_to_blog id="10"] [list_posts limit="10"] [/switch_to_blog] iterator 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). [iterator id="my-ads" repeat="5"] My ad codes [/iterator] After every 5th call to that shortcode, render the output. get_template 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: [get_template slug="includes/slider"] scheduler Show text or shortcodes only if the specified date has passed. Example, show the text only if it's after Christmas of 2016: [scheduler date="December 25, 2016"] Text [/scheduler] date Shows the current date or time in the specified format (http://codex.wordpress.org/Formatting_Date_and_Time). Uses Date Format (in Settings > General) by default. [date format="F j, Y"] loginoutlink Display a link to login page if user is not logged-in, or a logout page if they are. Parameters: login_form Display the login form. custom_field Display a custom field from a post. Parameters: disable Wrap any content or shortcode with [disable] shortcode to prevent that piece of content from being rendered. Perfect for debugging shortcodes. the_id Shows the current post ID; useful when you need to debug WP Loops. Path shortcodes [home_url] : returns the homepage URL [get_template_directory] : Absolute path to the parent theme directory [get_template_directory_uri] : URL to the directory of the parent theme [get_stylesheet_directory] : Absolute path to the directory of the child theme [get_stylesheet_directory_uri] : URL to the directory of the child theme rand shortcodes Show a random number between two numbers. Parameters: get_var Retrieve a value from $_GET or $_POST variables. To get a URL query string: [get_var get="myvar"] To get a value from POST: [get_var post="myvar"]

安装:

  1. Upload the the plugin directory to the /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Enjoy!