Views Shortcodes

Selecting the Post

All Views shortcode let you specify an optional id argument, which controls which post to process. Using the id argument, you can display fields of specific posts, or of parent posts.

Read more about displaying fields of parent pages.

If you don’t specify the id, Views will return the fields of the current post, or the post in the View loop.

wpv-pagination

Description: Display the pagination controls that are within the shortcode. The pagination controls will only be displayed if there are multiple pages to display
Parameters: This has no parameters.
File name: wpv-pagination-embedded.php

wpv-pager-num-page

Description: Display the maximum number of pages found by the Views Query.
Parameters: This has no parameters.
File name: wpv-pagination-embedded.php

wpv-pager-prev-page

Description: Display a "Previous" link to move to the previous page.
Parameters: This has no parameters.
Example usage: [wpv-pager-prev-page]Previous[/wpv-pager-prev-page]
File name: wpv-pagination-embedded.php

wpv-pager-next-page

Description: Display a "Next" link to move to the next page.
Parameters: This has no parameters.
Example usage: [wpv-pager-next-page]Next[/wpv-pager-next-page]
File name: wpv-pagination-embedded.php

wpv-pager-current-page

Description: Display the current page number. It can be displayed as a number or as a drop-down list to select another page.
Parameters: ‘style’ => leave empty to display a number.
‘style’ => ‘drop_down’ to display a selector to select another page.
‘style’ => ‘link’ to display a series of links to each page
File name: wpv-pagination-embedded.php

wpv-filter-start

Description: The [wpv-filter-start] shortcode specifies the start point for any controls that the views filter generates. Example controls are pagination controls and search boxes. This shortcode is usually added automatically to the Views Meta HTML.
Parameters: This takes no parameters.
File name: wpv-filter-embedded.php

wpv-filter-end

Description: The [wpv-filter-end] shortcode is the end point for any controls that the views filter generates.
Parameters: This takes no parameters.
File name: wpv-filter-embedded.php

wpv-filter-submit

Description: The [wpv-filter-submit] shortcode adds a submit button to the form that the views filter generates. An example is the "Submit" button for a search box
Parameters: ‘hide’ => ‘true’|'false’
‘name’ => The text to be used on the button.
File name: wpv-filter-embedded.php

wpv-post-count

Description: The [wpv-post-count] shortcode displays the number of posts that will be displayed on the page. When using pagination, this value will be limited by the page size and the number of remaining results.
Parameters: This takes no parameters.
Example usage: Showing [wpv-post-count] posts of [wpv-found-count] posts found
File name: wpv-filter-embedded.php

wpv-found-count

Description: The [wpv-found-count] shortcode displays the total number of posts that have been found by the Views query. This value is calculated before pagination, so even if you are using pagination, it will return the total number of posts matching the query.
Parameters: This takes no parameters.
Example usage: Showing [wpv-post-count] posts of [wpv-found-count] posts found
File name: wpv-filter-embedded.php

wpv-posts-found

Description: The wpv-posts-found shortcode will display the text inside the shortcode if there are posts found by the Views query.
Parameters: This takes no parameters.
Example usage: [wpv-posts-found]Some posts were found[/wpv-posts-found]
File name: wpv-filter-embedded.php

wpv-no-posts-found

Description: The wpv-no-posts-found shortcode will display the text inside the shortcode if there are no posts found by the Views query.
Parameters: This takes no parameters.
Example usage: [wpv-no-posts-found]No posts found[/wpv-no-posts-found]
File name: wpv-filter-embedded.php

wpv-control

Description: Add filters for View
Parameters: type: type of retrieved field layout (radio, checkbox, select, textfield, checkboxes, datepicker)
url_param: the URL parameter passed as an argument
values: Optional. a list of supplied values
display_values: Optional. A list of values to display for the corresponding values
auto_fill: Optional. When set to a "field-slug" the control will be populated with custom field values from the database.
auto_fill_default: Optional. Used to set the default, unselected, value of the control. eg Ignore or Don’t care
auto_fill_sort: Optional. ‘asc’, ‘desc’, ‘ascnum’, ‘descnum’, ‘none’. Defaults to ascending.
field: Optional. a Types field to retrieve values from
title: Optional. Use for the checkbox title
taxonomy: Optional. Use when a taxonomy control should be displayed.
default_label: Optional. Use when a taxonomy control should be displayed using select input type.
date_format: Optional. Used for a datepicker
control
More details: More details about this shortcode here: http://wp-types.com/documentation/wpv-control-fields-in-front-end-filters/
File name: wpv-filter-embedded.php

wpv-no-taxonomy-found

Description: The [wpv-no-taxonomy-found] shortcode will display the text inside the shortcode if there are no taxonomys found by the Views query.
Parameters: This takes no parameters.
Example usage: [wpv-no-taxonomy-found]No taxonomy found[/wpv-no-taxonomy-found]
File name: wpv-filter-taxonomy-embedded.php

wpv-bloginfo

Description: Display bloginfo values.
Parameters: ‘show’ => parameter for show.
"name" displays site title (Ex. "Testpilot")(Default)
"description" displays tagline (Ex. Just another WordPress blog)
"admin_email" displays (Ex. admin@example.com)
"url" displays site url (Ex. http://example/home)
"wpurl" displays home url (Ex. http://example/home/wp)
"stylesheet_directory" displays stylesheet directory (Ex. http://example/home/wp/wp-content/themes/child-theme)
"stylesheet_url" displays stylesheet url (Ex. http://example/home/wp/wp-content/themes/child-theme/style.css)
"template_directory" displays template directory (Ex. http://example/home/wp/wp-content/themes/parent-theme)
"template_url" displays template url (Ex. http://example/home/wp/wp-content/themes/parent-theme)
"atom_url" displays url to feed in atom format (Ex. http://example/home/feed/atom)
>"rss2_url" displays url to feed in rss2 format (Ex. http://example/home/feed)
"rss_url" displays url to feed in rss format (Ex. http://example/home/feed/rss)
"pingback_url" displays pingback url (Ex. http://example/home/wp/xmlrpc.php)
"rdf_url" displays rdf url(Ex. http://example/home/feed/rdf)
"comments_atom_url" displays comments atom url (Ex. http://example/home/comments/feed/atom)
"comments_rss2_url" displays comments rss2 url (Ex. http://example/home/comments/feed)
"charset" displays site charset (Ex. UTF-8)
"html_type" displays site html type (Ex. text/html)
"language" displays site language (Ex. en-US)
"text_direction" displays site text direction (Ex. ltr)
"version" displays WordPress version (Ex. 3.1)
Example usage: url: [vpw-bloginfo show="url"]
More details: List of available parameters http://codex.wordpress.org/Function_Reference/bloginfo#Parameters
File name: wpv-shortcodes.php
Description: Display archive link for selected post type.
Parameters: ‘name’ => post_type_name for show (Default = current post type).
Example usage: Archive link for places is on [wpv-archive-link name="places"]
File name: wpv-shortcodes.php

wpv-current-user

Description: Display information about current user.
Parameters: ‘info’ => parameter for show.
"display_name" displays user’s display name (Default)
"login" displays user’s login
"firstname" displays user’s first name
"lastname" displays user’s last name
"email" displays user’s email
"id" displays user’s user_id
"logged_in" displays true if user is logged in, false if not
"role" displays user’s role
Example usage: Current user is [wpv-current-user info="display_name"]
File name: wpv-shortcodes.php

wpv-post-id

Description: Display the current post’s ID
Parameters: This takes no parameters.
Example usage: ID is [wpv-post-id]
File name: wpv-shortcodes.php

wpv-post-title

Description: Display the current post’s title
Parameters: This takes no parameters.
Example usage: You are reading [wpv-post-title]
File name: wpv-shortcodes.php

wpv-post-link

Description: Display the current post’s title as a link to the post
Parameters: This takes no parameters.
Example usage: Permalink to [wpv-post-link]
File name: wpv-shortcodes.php

wpv-post-body

Description: Display the content of the current post
Parameters: ‘view_template’ => The name of a view template to use when displaying the post content.
Example usage: [wpv-post-body view_template="None"]
File name: wpv-shortcodes.php

wpv-post-excerpt

Description: Display the excerpt of the current post
Parameters: length => the length of the excerpt. Default is 252 or the excerpt length defined by the theme.
Example usage: [wpv-post-excerpt length="150"]
Notes: If manual excerpt is set then length parameter is ignored – full manual excerpt is displayed
File name: wpv-shortcodes.php

wpv-post-author

Description: Display the author of the current post
Parameters: format => The format of the output.
"name" displays the author’s name (Default)
"link" displays the author’s name as a link
"url" displays the url for the author
"meta" displays the author meta info
meta => The meta field to display when format="meta"
Example usage: Posted by [wpv-post-author format="name"]
More details: For info about the author meta fields, see http://codex.wordpress.org/Function_Reference/get_the_author_meta)
File name: wpv-shortcodes.php

wpv-post-date

Description: Display the date of the current post
Parameters: format => Format string for the date. Defaults to F jS, Y
Example usage: Published on [wpv-post-date format="F jS, Y"]
More details: Format parameter is the same as here – http://codex.wordpress.org/Formatting_Date_and_Time
File name: wpv-shortcodes.php

wpv-post-url

Description: Display the url to the current post
Parameters: This takes no parameters.
Example usage: [wpv-post-url]
File name: wpv-shortcodes.php

wpv-post-type

Description: Display the current post type
Parameters: ‘show’ => ‘slug’, ‘single’ or ‘plural’. Defaults to ‘slug’
Example usage: [wpv-post-type show="single"]
File name: wpv-shortcodes.php

wpv-post-featured-image

Description: Display the featured image of the current post
Parameters: ‘size’ => Image size – thumbnail, medium, large or full – defaults to thumbnail
‘raw’ => Show url (true) or HTML tag (false) – default to false (HTML tag)
Example usage: [wpv-post-featured-image size="medium" raw="false"]
File name: wpv-shortcodes.php

wpv-post-field

Description: Display a custom field of the current post. This displays the raw data from the field. Use the Types plugin the and the [types] shortcode to display formatted fields.
Parameters: ‘name’ => The name of the custom field to display
‘index’ => The array index to use if the meta key has multiple values. If index is not set then all values will be output
‘separator’ => The separator between multiple values. Defaults to ‘, ‘
Example usage: [wpv-post-field name="customfield"]
File name: wpv-shortcodes.php

wpv-post-comments-number

Description: Displays the number of comments for the current post
Parameters: ‘none’ => Text if there are no comments. Default – "No Comments"
‘one’ => Text if there is only one comment. Default – "1 Comment"
‘more’ => Text if there is more than one comment. Default "% Comments"
Example usage: This post has [wpv-post-comments-number none="No Comments" one="1 Comment" more="% Comments"]
File name: wpv-shortcodes.php

wpv-taxonomy-title

Description: Display the taxonomy title as a plain text
Parameters: This takes no parameters.
Example usage: [wpv-taxonomy-title]
File name: wpv-shortcodes.php
Description: Display the taxonomy title within a link
Parameters: This takes no parameters.
Example usage: [wpv-taxonomy-link]
File name: wpv-shortcodes.php

wpv-taxonomy-slug

Description: Display the taxonomy slug
Parameters: This takes no parameters.
Example usage: [wpv-taxonomy-slug]
File name: wpv-shortcodes.php

wpv-taxonomy-url

Description: Display the taxonomy URL as a plain text (not embedded in a HTML link)
Parameters: This takes no parameters.
Example usage: [wpv-taxonomy-url]
File name: wpv-shortcodes.php

wpv-taxonomy-description

Description: Display the taxonomy description text
Parameters: This takes no parameters.
Example usage: [wpv-taxonomy-description]
File name: wpv-shortcodes.php

wpv-taxonomy-post-count

Description: Display the number of posts in a taxonomy
Parameters: This takes no parameters.
Example usage: [wpv-taxonomy-post-count]
File name: wpv-shortcodes.php

wpv-post-taxonomy

Description: Display the taxonomy for the current post.
Parameters: ‘type’ => The name of the taxonomy to be displayed
‘separator’ => Separator to use when there are multiple taxonomy terms for the post. The default is a comma.
‘format’ => ‘link’, ‘text’ or ‘url’. Defaults to ‘link’
‘show’ => ‘name’, ‘description’, ‘slug’ or ‘count’. Defaults to ‘name’
‘order’ => ‘asc’, ‘desc’. Defaults to ‘asc’
Example usage: Filed under [wpv-post-taxonomy type="category" separator=", " format="link" show="name" order="asc"]
File name: wpv-shortcodes.php

wpv-for-each

Description: Iterate through multple items in a post meta field and output the enclosed text for each item
Parameters: ‘field’ => The name of post meta field.
Example usage: Output the field values as an ordered list
<ol>[wpv-for-each field="my-field"]<li>[wpv-post-field name="my-field"]</li>[/wpv-for-each]<ol>
Notes: wpv-if shortcode won’t work inside a wpv-for-each shortcode
File name: wpv-shortcodes.php

wpv-if

Description: Conditional shortcode to be used to display a specific area based on a custom field condition. \n Supported actions and symbols:\n Integer and floating-point numbers \n Math operators: +, -, *, / \n Comparison operators: <, >, =, <=, >=, != \n Boolean operators: AND, OR, NOT \n Nested expressions – several levels of parentheses \n Variables defined as shortcode parameters starting with a dollar sign \n empty() function that checks for empty or non-existing fields
Parameters: ‘condition’ => Define expected result from evaluate – either true or false
‘evaluate’ => Evaluate expression with fields involved, sample use: "($field1 > $field2) AND !empty($field3)"
‘debug’ => Enable debug to display error messages in the shortcode
‘fieldX’ => Define fields to be taken into account during evaluation
Example usage: [wpv-if evaluate="boolean condition"]
Execute code for true
[/wpv-if]
Sing a variable and comparing its value to a constant
[wpv-if f1="wpcf-condnum1" evaluate="$f1 = 1" debug="true"]Number1=1[/wpv-if]
Two numeric variables in a mathematical expression with boolean operators
[wpv-if f1="wpcf-condnum1" f2="wpcf-condnum2" evaluate="(2 < 3 AND (((3+$f2)/2) > 3 OR NOT($f1 > 3)))" debug="true"]Visible block[/wpv-if]
Compare custom field with a value
[wpv-if f1="wpcf-condstr1" evaluate="$f1 = ‘My text’" debug="true"]Text1=’My text’ [/wpv-if]
Display condition if evaluates to false (use instead of else-if)
[wpv-if condition="false" evaluate="2 > 3"] 2 > 3 [/wpv-if]
More details: Conditional HTML output in Views
File name: wpv-condition.php