Linux 软件免费装

WPQuery Shortcode

开发者 indyarmy
更新时间 2013年12月13日 14:18
PHP版本: 3.5 及以上
WordPress版本: 3.8
版权: MIT
版权网址: 版权信息

标签

shortcode query loop wp_query wpquery

下载

1.1.0 1.1.1 1.1.2 1.0.0

详情介绍:

WPQuery Shortcode is a lightweight plugin that wraps the functionality of WP_Query in an easy-to-use shortcode. Several filters are built in to allow all kinds of messing with how the output is displayed. From a simple "Recent Posts" block on your page to displaying upcoming events from your calendar plugin to showing the most visited job postings, WPQuery Shortcode makes it easy. Examples The most basic example is this: [wqs][/wqs] Which returns the following HTML by default: If you want to use a section tag instead of a div tag, use the following filters to override the defaults: function wqs_wrapper_start($class) { return " "; } WQSDefaults::remove_filter('wqs_wrapper_start'); // Removes the default filter add_filter('wqs_wrapper_start', 'wqs_wrapper_start'); function wqs_wrapper_end() { return ""; } WQSDefaults::remove_filter('wqs_wrapper_end'); // Removes the default filter add_filter('wqs_wrapper_end', 'wqs_wrapper_end'); If you want to use the plugin within another plugin or directly from your functions.php file in order to save yourself some trouble with The Loop: WQSDefaults::remove_all_filters(); // Removes all default filters // Add your own filters here. $wqs = WQS::get_instance(); $items = $wqs->wqs(array( 'cat' => 3, // More WP_Query parameters here ), 'Some header text here', TRUE); // Third param returns an array instead of a string. foreach ($items as $id => $item) { // do stuff }

安装:

  1. Upload the wpquery-shortcode folder to your wp-content/plugins/ folder
  2. Activate the plugin
  3. In your post or page (or anyplace that shortcodes are parsed), place the shortcode [wqs]Most Recent Posts[/wqs]

更新日志:

1.1.2 1.1.1 1.0.0