Custom Query Shortcode
This plugin gives you [query] shortcode which enables you to query and output any posts filtered by specific attributes. Usage You can use most parameters supported by WP_Query class to filter the posts; you can query for specific post types, categories, tags, authors, etc. Other supported parameters Aside from WP_Query parameters, the shortcode also supports the following additional parameters: featured: to query for sticky posts which by default are excluded from the query. thumbnail_size: to specify the size of the {THUMBNAIL} images. You can use built-in image sizes or custom ones you’ve defined. content_limit: to limit the number of words of the {CONTENT} var; by default it’s “0” which means it outputs the whole content. posts_separator: text to display between individual posts. lens: custom output template – see description below. twig_template: output template using Twig templating engine – requires the Timber library. Formatting the output You can define how you want to format the output inline within an opening [query] and closing [/query] tag. Available keywords are: TITLE, CONTENT, AUTHOR, AUTHOR_URL, DATE, THUMBNAIL, CONTENT, COMMENT_COUNT. The following example will display the latest 5 posts from the category with the ID of 3, showing a post title and comment count, with a link to the post: [query posts_per_page=”5″ cat=”3″] {TITLE} ({COMMENT_COUNT}) [/query] Grid display With the “cols” parameter you can display the output in a grid. [query posts_per_page=”3″ cols=”3″] {THUMBNAIL} {TITLE} {CONTENT} [/query] will display the latest 3 posts in the defined template, in 3 columns. The plugin will automatically divide the grid into rows based upon the ‘posts_per_page’ option, divided by the ‘cols’ option. Lenses (output templates) With the “lens” parameter you can customize the display of the query results using a template. Some basic lenses/templates are provided: ul: unordered list of linked post titles. ul-title-date: same as ‘ul’, but also displays the posted date. article-excerpt: series of articles, with a header containing the linked post title, and the excerpt. article-excerpt-date: same as ‘article-excerpt’, but also displays the posted date. cards: displays the post thumb above the header with linked post title, followed by the excerpt. Bootstrap lenses Some pre-defined lenses/templates are provided which use JavaScript Components from the Bootstrap CSS framework. The generated markup is compliant with the 5.x version of Bootstrap. This feature relies on Bootstrap library to be already loaded on the page, the plugin does not include it. If you’re using a Bootstrap-based theme, this should work; otherwise you can use the Bootstrap plugin). Tabs This will show the latest 3 posts in a tabbed widget. [query posts_per_page=”3″ lens=”tabs”] Accordion This will create an accordion widget of all our posts from the “faq” post type. [query posts_per_page=”0″ post_type=”faq” lens=”accordion”] Carousel This creates a carousel of latest five featured posts: [query posts_per_page=”5″ featured=”true” lens=”carousel”] Custom Lenses/templates You can create your own custom templates and put them into one of these pre-defined folder names within your theme: ‘query-shortcode-templates’ ‘partials/query-shortcode-lenses/’ ‘html/lenses/’ Or simply specify your own subfolder in the ‘lens’ parameter: [query lens=”folder/template-name”] Twig Template Support Starting with version 0.4, you can use Twig templates for your output. Support for Twig is provided by the Timber library. This requires that Timber 2.x be installed as a Composer dependency. To use a Twig template for your query output, simply use the 'twig_template' parameter instead of the 'lens' parameter, and provide the path to your template. By default, Timber looks within the views folder in your active theme. You can change the default template location in Timber. Examples: [query twig_template="template-name.twig"] [query twig_template="folder/template-name.twig"]
Top keywords
- query21×3.31%
- posts16×2.52%
- template11×1.74%
- twig10×1.58%
- output9×1.42%
- post9×1.42%
- lens7×1.10%
- page7×1.10%
- content6×0.95%
- display6×0.95%
- lenses6×0.95%
- per6×0.95%
Stealth Publish
This plugin allows you to prevent specified posts from being featured on the front page or in feeds, and from notifying external services of publication. Beneficial in instances where you want to publish new content without any fanfare and just want the post added to archive and category pages and its own permalink page. A “Stealth publish?” checkbox is added to the “Write Post” admin page. Posts which are saved with that checkbox checked will no longer be featured on the front page of the blog, nor will the post be included in any feeds. A stealth published post will also not notify any external services about the publication. This includes not sending out pingbacks, trackbacks, and pings to update services such as pingomatic.com. This behavior can be overridden via the ‘c2c_stealth_publish_silent’ filter (see Filters section). NOTES: Use of other plugins making their own queries against the database to find posts will possibly allow a post to appear on the front page. But use of the standard WordPress functions for retrieving posts (as done for the main posts query and the recent posts widget) should not allow stealth published posts to appear on the home page. If you use this plugin, you do not need to use my Silent Publish plugin as that functionality is incorporated into this plugin. Alternatively, if you like the silent publishing feature but want your new posts to appear on your blog’s front page and in feeds, then just use the “Silent Publish” plugin. The plugin records when a post is stealth published, so subsequent edits of the post will have the “Stealth publish?” checkbox checked by default. Links: Plugin Homepage | Plugin Directory Page | Author Homepage Filters The plugin is further customizable via three filters. Typically, these customizations would be put into your active theme’s functions.php file, or used by another plugin. c2c_stealth_publish_meta_key (filter) The ‘c2c_stealth_publish_meta_key’ filter allows you to override the name of the custom field key used by the plugin to store a post’s stealth publish status. This isn’t a common need. Arguments: $custom_field_key (string): The custom field key to be used by the plugin. By default this is ‘_stealth-publish’. Example: /** * Defines a custom meta key to be used by Stealth Publish. * * @param string $custom_field_key The default custom field key name. * @return string */ function override_stealth_publish_key( $custom_field_key ) { return '_my_custom_stealth-publish'; } add_filter( 'c2c_stealth_publish_meta_key', 'override_stealth_publish_key' ); c2c_stealth_publish_silent (filter) The ‘c2c_stealth_publish_silent’ filter allows you to override whether the plugin also ensure the post gets published silently (i.e. without sending out pingbacks, tracbacks, and pings to update services). Arguments: $publish_silently (bool): Should stealth published posts also be published silently? By default this is ‘true’. $post_id (int): The ID of the post being published. Example: /** * Disable silent publishing for stealth published posts. * * @param bool $publish_silently True if the post is to be published silently. * @param int $post_id The post ID. * @return Always false. */ function override_stealth_publish_silent( $publish_silently, $post_id ) { return false; } add_filter( 'c2c_stealth_publish_silent', 'override_stealth_publish_silent' ); c2c_stealth_publish_default (filter) The ‘c2c_stealth_publish_default’ filter allows you to override the default state of the ‘Stealth Publish?’ checkbox. Arguments: $state (boolean): The default state of the checkbox. By default this is false. $post (WP_Post): The post currently being created/edited. Example: // Have the Stealth Publish? checkbox checked by default. add_filter( 'c2c_stealth_publish_default', '__return_true' );