Skip Navigation

Views Shortcodes

WooCommerce Blocks

Note: You need to have WooCommerce Blocks plugin installed for these shortcodes to work

wpv-woo-buy-or-select

description:

This shortcode outputs the Add to cart button for the product listing page.

For variable products the Select options button will be displayed.

For “normal” products, the Add to cart button will be displayed. Clicking this will add the product to cart (using AJAX, meaning no page refresh needed) if the setting in WooCommerce -> Settings -> Products -> Display -> Shop & Product Pages -> Add to cart behaviour -> Enable AJAX Add to cart buttons on archives, is checked. Once added, a visual indicator will appear next to the button along with a link to view the cart. Otherwise, if ‘Enable AJAX add to cart buttons on archives’ setting is unchecked, page will refresh when item is added to the cart.

For variable products, the user first has to select a product variation, the Select options button will take the user to the product detail page, where they can select a Variant and add it to the cart.

context:
product listing
attributes:
  • add_to_cart_text (opt): 'Add to cart' (default)

    Text for the Add to cart button. Applies to Normal products.

  • show_quantity_in_button (opt): 'yes' | 'no' (default)

    When used, it will show the quantity selector next to the Add to cart button (only on the listing page).

  • group_add_to_cart_text: 'Add to cart' (default)

    Text for the Add to cart button, for grouped products.

  • external_add_to_cart_text (opt): show_variation_options (opt)

    Whether to show variation drop down select in the listing pages.

    Please note that if you are setting the show_variation_options=”yes”, it won’t use the customized Add to cart text set in the link_to_product_text attribute. This is because it is only meant to be used if the show_variation_options is set to “no”.

  • link_to_product_text (opt): 'Select options' (default)

    Button text for Variable products. Applies to Variable products.

shortcode example:
[wpv-woo-buy-or-select add_to_cart_text="Add to basket" link_to_product_text="More details"]

wpv-woo-product-price

description:

This shortcode outputs the product price.

For Variable products the Select options button will be displayed.

context:
single product page and product listing
attributes:
This shortcode has no attributes
shortcode example:

For Normal products, the price will be displayed.

For On-sale products, the old price and new price will be displayed.

For Variable products, the lowest price for a Variation will be displayed, preceded by the text “From”.

wpv-woo-buy-options

description:

This shortcode outputs the Add to cart button on the Product detail pages for simple products. For Variable products, a user will be presented with a drop-down menu of Variations to select from.

For other product types, the shortcode output will adjust automatically to the correct Add to cart button output. For example, the product bundle or a group appears before the button. For an external product, the Add to cart button links to an external or affiliate site.

context:
single product page
attributes:
  • add_to_cart_text (opt): 'Add to cart' (default)

    Text for the Add to cart button.

shortcode example:
[wpv-woo-buy-options add_to_cart_text="Purchase me"]

wpv-woo-product-image

description:

This shortcode displays the product image (featured image), wrapped in a link to the full-size image.

For Variable products, the featured image will be displayed, unless a default variation is set. If a product variation is selected the variation image will be displayed if set, if not, the featured image will be displayed.

If no featured image is set, the WooCommerce placeholder image will be displayed.

Tip 1: Some themes will automatically display featured image on the product page. As a result, if you are using the [wpv-woo-product-image] shortcode in a product Content Template, the image will appear duplicated.

Tip 2: When outputting WooCommerce product images in listings customized by Toolset, the best practice is to use the img_tag format wrapped in links.

<a href="[wpv-post-url]">[wpv-woo-product-image size='shop_single' output='img_tag' enable_third_party_filters='no' gallery_on_listings='no']</a>

This ensures that images are displayed either using AJAX or non-AJAX based sliders. This is also how WooCommerce core plugin displays its products in listings. Only use the default WooCommerce image dimensions in listings when you would like to display gallery images.

Please note: avoid using “product” as a class for your div and other HTML tags inside your Content Template or a Content Template cell (in Layouts). This is no longer necessary since the div tag for the main product (parent div) is already wrapped with the “product” class by the WooCommerce itself. This is important for the variation image selection of WooCommerce variation products to work.

Additionally, it is best to use “WooCommerce default” as the output format when outputting variation products. This is because the WooCommerce plugin automatically adds all the necessary HTML markup for this to work. If you use the img_tag or other output formats, you need to manually add the necessary markup inside your Content Template or a Layout cell for variation image compatibility.

context:
single product page and product listing
attributes:
  • gallery_on_listings (opt): yes | no

    Whether to show product images as a gallery on archive pages. Galleries are always shown on single product pages where available.

  • enable_third_party_filters (opt): yes | no

    Enables third party plugins and themes to hook into the WooCommerce Product image functions woocommerce_before_single_product_summary and woocommerce_before_shop_loop_item. If you are using a third-party plugin or your theme features custom code using these specific hooks, you need to set it to “yes” to enable it. Setting to “yes” displays the output of these hooks before the WooCommerce product images. Please note that WooCommerce Blocks does not have full control of these third party plugins or custom code. This is set to “no” by default, to avoid any image display issues.

  • size (opt): 'thumbnail' | 'medium' | 'large'' | 'full' | 'shop_single' (default) | 'shop_catalog' | 'shop_thumbnail' | 'custom image size'

    The shop_single, shop_catalog and shop_thumbnail sizes can be set in WooCommerce -> Settings -> Catalog -> Image Options

  • output (opt): 'raw' | 'img_tag'

    By default the image will be wrapped in a link to the full-size version.

    When output=’raw’ is used, image tag will not be wrapped in a link.

    When output=’img_tag’ is used, image url for the image will be output.

    Read more about custom image sizes in WordPress

shortcode example:
[wpv-woo-product-image size="shop_single"]

wpv-woo-display-tabs

description:

This shortcode displays WooCommerce product tabs. By default this will display product reviews and product attributes.

WooCommerce product tabs replaces post/page comments with Product reviews – you’ll want to disable the comment section on your product page if it is enabled.

context:
single product page
attributes:
  • disable_reviews_tab (opt): yes | no

    When used, it will remove the Reviews tab from the WooCommerce Product data tab on the front-end. This is useful if you are outputting the WooCommerce Product Reviews section using the wpv-woo-reviews shortcode.

wpv-add-to-cart-message

description:

This shortcode displays a success message when a product is added to the cart. It can also show exception messages if, for example – there is insufficient stock.

You will want to add this to your product detail page and your product listing pages.

Add to cart message shortcode is not meant to be repeated for every item in the loop. It should only be displayed in a prominent position. It is best to place the shortcode before wpv-loop or before the beginning of any loop. The reason for this is because Add to cart message is not meant to be unique for every item.

Please note that there is an extra step involved if you want to use the wpv-add-to-cart-message on the product listing pages. Go to the WooCommerce -> Settings page, click the Products tab and then the Display tab. There, uncheck the Enable AJAX add to cart buttons on archives option. This is needed because a page refresh is required for WooCommerce “Add to cart” message to work.

context:
single product page and product listing
attributes:
This shortcode has no attributes

wpv-woo-list_attributes

description:

This shortcode outputs product attributes in WooCommerce

You need to set product attributes when editing WooCommerce products in the back-end and then go to Product data -> Attributes.

Additionally, attributes can be set in Products -> Attributes.

WooCommerce supports attributes for Simple, VariationExternal, and Grouped products. If this is not set, nothing will
be displayed.

context:
single product page and product listing
attributes:
This shortcode has no attributes

wpv-woo-onsale

description:

This shortcode outputs the default WooCommerce on-sale badge icon which is appended to the WooCommerce product image.

If you have set a Sale Price for your product, you can display the on-sale badge appended to the product image using this shortcode. If the product is not on sale, no output will be generated. For this to work properly, the on-sale badge shortcode should be placed directly before the product image shortcode and nowhere else.

context:
single product page and product listing
attributes:
This shortcode has no attributes
shortcode example:
[wpv-woo-onsale][wpv-woo-product-image]

wpv-woo-single-products-rating

description:

This shortcode outputs WooCommerce product ratings to single product pages.

If someone rates your product, you can display the product ratings in front-end using this shortcode. If your product has not yet received a rating, no output will be generated.

context:
single product page
attributes:
This shortcode has no attributes

wpv-woo-products-rating-listing

description:

This shortcode outputs WooCommerce product ratings to product listings and loops.

This shortcode is designed to display product ratings on shop pages, product listings, and product loops. When there is rating information for the product, it will be displayed. Otherwise, if there is no rating, nothing will display.

context:
product listing
attributes:
This shortcode has no attributes

wpv-woo-productcategory-images

description:

This shortcode outputs WooCommerce product category images that are set in the back-end (Products -> Categories).

This works inside loops that output product categories.

WooCommerce allows its product categories to have an image assigned to them. You can display these images on the front-end using this shortcode. If the category does not have an image, nothing will be displayed.

Please note that this shortcode will output the category image only when used within the category loop.

context:
product listing
attributes:
  • size (opt): 'thumbnail' | 'medium' | 'large' | 'full' | 'shop_single' (default) | 'shop_catalog' | 'shop_thumbnail' | custom image size

    Default: shop_single – standard WooCommerce product image size option.

  • output (opt): 'raw' | 'img_tag'

    This attribute format the output. Possible values:

    output=’raw’ outputs raw URL of the category image.

    output=’img_tag’ outputs an HTML image tag.

shortcode example:

This example will output the image tag of the category image. Image will be output using the thumbnail size.

[wpv-woo-productcategory-images output="img_tag" size="thumbnail"]

wpv-woo-show-upsell-items

description:

This shortcode outputs items for upselling. You can follow this WooCommerce guide to learn more about how to configure items for upselling.

This shortcode is designed to display upsell items in the front-end. If you don’t have this setup, nothing will be displayed.

context:
single product page
attributes:
This shortcode has no attributes

wpv-woo-breadcrumb

description:

This shortcode outputs default WooCommerce breadcrumbs and can be used anywhere in the Content Template (as specified by the user).

Since WooCommerce Blocks version 2.7.1, WooCommerce breadcrumb shortcode can also be used on listings pages.

context:
single product page and product listing
attributes:
This shortcode has no attributes

wpv-woo-reviews

description:

This shortcode displays the review comment form. It is useful when you need to display only the comment section for the product and you are not outputting Reviews inside the WooCommerce product tabs.

Since the 2.6.1 version of WooCommerce Blocks, it is now possible to use both wpv-woo-display-tabs and wpv-woo-reviews shortcodes in your template. To avoid outputting the reviews section twice, you need to set the new shortcode attribute ‘disable_reviews_tab’ to ‘yes’ for the wpv-woo-display-tabs. This will remove Reviews from the product tab and render them correctly using the wpv-woo-reviews shortcode.

context:
single product page
attributes:
This shortcode has no attributes

wpv-woo-product-meta

description:

This shortcode outputs the WooCommerce product meta. It basically calls the WooCommerce woocommerce_template_single_meta() function that by default outputs the following:

  • Product SKU
  • Categories
  • Tags
context:
single product page
attributes:
This shortcode has no attributes

wpv-woo-cart-count

description:

This shortcode renders the number of items in the cart and displays it inside a span element. It can be used on a single product page and within product listing context.

context:
single product page
attributes:
This shortcode has no attributes
shortcode example:
[wpv-woo-cart-count]

wpv-ordered-product-ids

description:

This shortcode outputs ordered product IDs in a comma-separated format. This shortcode should only be used inside a View, layout or a Content Template that displays WooCommerce orders. It can be used on a single WooCommerce order page or a WooCommerce orders listing page.

This shortcode does not work when inserted into a single products page or product listings.

context:
single order page and order listing
attributes:
This shortcode has no attributes
shortcode example:
[wpv-ordered-product-ids]

General info

wpv-bloginfo

description:

This shortcode displays information about your site, mostly gathered from the information you supply in your User Profile and General Settings WordPress Administration Screens.

The Views shortcode simply wraps the functionality of the WordPress bloginfo function.

context:
inside the view loop or content template
attributes:
shortcode example:
[wpv-bloginfo show="url"]

Will display the URL for your site.

wpv-login-form

description:

This shortcode displays a standard WordPress login form. It does not add any custom HTML structure, only outputs what the native WordPress function does.

By default, after an authorization attempt, both successful and not, it redirects users back to the same page where the shortcode was inserted.

You need to specifically allow safe redirection to external subdomains or domains by going to the Toolset -> Settings page, clicking on the Front-end Content tab and scrolling to the Safe redirects section. This feature also supports wildcards, like *.example.com, to allow all possible subdomains of a domain.

context:
can be used anywhere
attributes:
  • redirect_url_fail (opt): An absolute URL

    If redirect_url_fail attribute is set, visitors are redirected to the specified URL when the login fails. By default, the user is redirected to the native WordPress login page (wp-login.php). The URL used must be an absolute URL within the same website or within the allowed redirect hosts.

    If redirect_url_fail was not set and the authorization fails, visitors are redirected back to the same page where the shortcode was inserted.

  • redirect_url (opt): An absolute URL

    If redirect_url attribute is set, visitors will be redirected to the specified URL. The URL used must be an absolute URL within the same website or within the allowed redirect hosts.

  • allow_remember (opt): 'true' | 'false' (default)

    If allow_remember attribute is set, the Remember me checkbox will be enabled for the login form.

  • remember_default (opt): 'true' | 'false' (default)

    If remember_default attribute is set, the Remember me checkbox will be checked by default.

shortcode example:
[wpv-login-form redirect_url="http://www.my-demo-site.com/blog" allow_remember="true" remember_default="true"]

This will display a login form, allow user to be remembered, check the Remember me box by default and take the user to the www.my-demo-site.com/blog URL after logging in.

Please note: Redirect only works to an in-site URL and only if this URL exists. Otherwise, WP Admin will be loaded.

wpv-current-user

description:

This shortcode outputs the information about the current, logged-in user.

context:
inside the view loop or content template
attributes:
  • info (opt): 'display_name' (default) | 'login' | 'firstname' | 'lastname' | 'email' | 'id' | 'logged_in' | 'role'

    The logged_in option will return the value ‘true’ or ‘false’. Find out more about user fields.

  • format: 'name' (default) | 'link' | 'url' | 'meta' | 'profile_picture'

  • profile-picture-size (opt): 'size in pixels'

  • profile-picture-shape (opt): 'circle' (default) | 'square'

  • profile-picture-alt (opt): 'alt attribute of the image HTML tag'

  • profile-picture-default-url (opt): 'URL'

    Default image to use in case the current post author does not have any defined profile picture. Defaults to the one set in the WordPress settings.

shortcode example:
[wpv-current-user info="lastname"]

wpv-forgot-password-form

description:

This shortcode displays a simple form to request a user password reset. It only features a field for entering an email address or a username.

Please note that the form output by this shortcode is only visible to users that are not logged-in.

You need to specifically allow safe redirection to external subdomains or domains by going to the Toolset -> Settings page, clicking on the Front-end Content tab and scrolling to the Safe redirects section. This feature also supports wildcards, like *.example.com, to allow all possible subdomains of a domain.

For the redirections to work on a multisite installation, you need to make sure the following is also set up:

  • The Views plugin must be enabled on both the main and the subsite of your multisite installation.
  • Go to the Toolset -> Settings page of the main site and click the Front-end Content tab. There, scroll to the Safe redirects section and add your subdomains to the list, or use *.example.com.
context:
can be used anywhere
attributes:
  • redirect_url (opt): An absolute URL |

    URL that defines where the user is redirected to when the submission is successful. By default, that is the current page.  The URL used must be an absolute URL within the same website or within the allowed redirect hosts.

  • redirect_url_fail (opt): An absolute URL

    This URL defines where the user is redirected to when the submission fails. By default, that is the current page. The URL used must be an absolute URL within the same website or within the allowed redirect hostsWhen submission fails, some messages can be displayed, depending on the error type. These messages can be customized using the wpv_filter_override_auth_errors filter.

  • reset_password_url (opt): An absolute URL

    This link is displayed in an email sent to a user requesting a password reset. This is particularly useful if you want to provide a custom “Reset Password” page. You can use the [wpv-reset-password-form] shortcode, to display a custom reset password form.

  • Syntax:

    Default usage:

     [wpv-forgot-password-form] 

    With attributes:

    [wpv-forgot-password-form redirect_url='...' redirect_url_fail='...' reset_password_url='...']
shortcode example:

Default usage:

 [wpv-forgot-password-form] 

Redirecting to a specific page after a successful form submission:

 [wpv-forgot-password-form redirect_url='http://example.com/my-custom-login-page/'] 

Sending a custom page URL to reset password in reset password email:

 [wpv-forgot-password-form  reset_password_url='http://example.com/my-custom-reset-password-page/'] 

wpv-reset-password-form

description:

This shortcode displays a simple form to reset a user password. It only features the “New Password” and “Repeat new password” fields.

Please note that the form output by this shortcode is only visible to users that are not logged-in.

You need to specifically allow safe redirection to external subdomains or domains by going to the Toolset -> Settings page, clicking on the Front-end Content tab and scrolling to the Safe redirects section. This feature also supports wildcards, like *.example.com, to allow all possible subdomains of a domain.

context:
can be used anywhere
attributes:
  • redirect_url (opt): An absolute URL

    This URL defines where the user is redirected if the operation is successful (default is current page). The URL used must be an absolute URL within the same website or within the allowed redirect hosts.

  • redirect_fail (opt): An absolute URL

    This URL defines where the user is redirected after a failed operation (default is current URL). The URL used must be an absolute URL within the same website or within the allowed redirect hostsSome messages can be displayed for each appropriate errors before input fields, on a failed operation. These messages can be filtered using ‘wpv_filter_override_auth_errors’ filter.

  • Syntax: Syntax

    By default:

     [wpv-reset-password-form] 

    With attributes:

    [wpv-reset-password-form redirect_url='...' redirect_url_fail='...' reset_password_url='...']
shortcode example:

Default usage:

 [wpv-reset-password-form] 

Redirecting a user to custom “success” and “error” pages.

[wpv-reset-password-form redirect_url='http://example.com/my-custom-login-page/' redirect_url_fail='http://example.com/my-custom-error-page/'] 

wpv-taxonomy-archive

description:

This shortcode displays information about the current taxonomy (usable only for taxonomy queries).

context:
inside a taxonomy WordPress archive
attributes:
  • info (opt): 'name' (default) | 'slug' | 'description' | 'id' | 'taxonomy' | 'parent' | 'count'

    When querying a term archive, info=’taxonomy’ will output the taxonomy name that the term belongs to.

shortcode example:
Archive for [wpv-taxonomy-archive info="name"]

wpv-search-term

description:

This shortcode displays the search term when visiting the search results page, mainly if it is controlled using a WordPress Archive created in Views.

context:
layout meta HTML (not in loop)
attributes:
  • param (opt): 'URL parameter'

    The URL parameter used to post the actual search value, defaults to the one used by WordPress (‘s’)

shortcode example:
You are searching for [wpv-search-term]

Pagination controls

wpv-pagination

description:

This shortcode displays the pagination controls. The pagination controls will only be displayed if there are multiple pages to display.

context:
filter meta HTML
attributes:
This shortcode has no attributes

wpv-post-previous-link

description:

This shortcode renders the link to the previous post, in relation to the one currently being viewed.

context:
filter meta HTML
attributes:
  • format: 'format of the anchor'

    This argument is used to specify anchor format for the link to the next or previous post, depending on the used shortcode. It should contain %%LINK%% in order to display the link in question, otherwise, it will create plain text. The default value is “« %%LINK%%”.

  • link: 'format for the permalink'

    This argument is used to specify permalink format for the link to the next or previous post, depending on the used shortcode. It can contain %%TITLE%%for the post’s title or %%DATE%%’ for the post’s date. The default value is %%TITLE%%.

  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

shortcode example:
[wpv-post-previous-link format="« %%LINK%%" link="Previous post: %%TITLE%%"]

wpv-post-next-link

description:

This shortcode renders the link to the next post, in relation to the one currently being viewed.

context:
filter meta HTML
attributes:
  • format: 'format of the anchor'

    This argument is used to specify anchor format for the link to the next or previous post, depending on the used shortcode. It should contain %%LINK%% in order to display the link in question, otherwise, it will create plain text. The default value is “« %%LINK%%”.

  • link: 'format for the permalink'

    This argument is used to specify permalink format for the link to the next or previous post, depending on the used shortcode. It can contain %%TITLE%%for the post’s title or %%DATE%%’ for the post’s date. The default value is %%TITLE%%.

  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

shortcode example:
[wpv-post-next-link format="%%LINK%% »" link="Next post: %%TITLE%%"]

wpv-pager-current-page

description:

This shortcode displays the current page number. It can be displayed as a number or as a drop-down list to select another page.

context:
filter meta HTML
attributes:
  • force: 'true' | 'false' (default)

    Setting value to true will enforce the shortcode to return 1 when there is only one page.
    By default it is false and the shortcode will not return any value when there is only one page.

  • style: 'drop_down' | 'link'

    The drop_down option will display page numbers in a drop-down menu while link will display a link icon for each page. By default linked page numbers will be displayed.

shortcode example:
[wpv-pager-current-page style='drop_down']

wpv-pager-next-page

description:

This shortcode displays a link for navigating to the next page.

context:
filter meta HTML
attributes:
  • style (opt): 'style'

    The style of the element. Takes a string value and will be added unchanged to the HTML element

  • class (opt): 'class names separated by space'

    The class of the element. Takes a string value and will be added unchanged to the HTML element

shortcode example:
[wpv-pager-next-page]Next[/wpv-pager-next-page]

wpv-pager-prev-page

description:

This shortcode displays a link to navigate to the previous page.

context:
filter meta HTML
attributes:
  • style (opt): 'style'

    The style of the element. Takes a string value and will be added unchanged to the HTML element

  • class (opt): 'class names separated by space'

    The class of the element. Takes a string value and will be added unchanged to the HTML element

shortcode example:
[wpv-pager-prev-page]Previous[/wpv-pager-prev-page]

wpv-pager-total-pages

description:

This shortcode outputs the total number of pages found by the Views query.

context:
filter meta HTML
attributes:
  • force: 'true' | 'false' (default)

    Setting value to true will enforce the shortcode to return 1 when there is only one page.
    By default it is false and the shortcode will not return any value when there is only one page.

wpv-pager-nav-dropdown

description:

Displays a dropdown list with page numbers, enabling visitors to select a page.

context:
filter meta HTML
attributes:
This shortcode has no attributes
shortcode example:
[wpv-pager-nav-dropdown]

wpv-pager-archive-current-page

description:

This shortcode displays the current page number.

context:
layout meta HTML (not in loop)
attributes:
This shortcode has no attributes
shortcode example:
[wpv-pager-archive-current-page]

wpv-pager-archive-total-pages

description:

This shortcode displays the total pages number.

context:
layout meta HTML (not in loop)
attributes:
This shortcode has no attributes
shortcode example:
[wpv-pager-archive-total-pages]

wpv-pager-archive-prev-page

description:

This shortcode displays a link to navigate to the previous page.

context:
layout meta HTML (not in loop)
attributes:
  • force (opt): 'true'

    Forces display of link to previous page, when on the first page

shortcode example:
[wpv-pager-archive-prev-page]
[wpv-pager-archive-prev-page force="true"]

wpv-pager-archive-next-page

description:

This shortcode displays a link to navigate to the previous page.

context:
layout meta HTML (not in loop)
attributes:
  • force (opt): 'true'

    Forces display of link to next page, when on the last page

shortcode example:
[wpv-pager-archive-next-page]
[wpv-pager-archive-next-page force="true"]

Controlling output

wpv-filter-meta-html

description:

This shortcode outputs the pagination and custom search HTML for your View. This shortcode along with wpv-layout-meta-html is in the Combined Output meta HTML section of your View.

If you delete this shortcode from the Combined Output meta HTML for your View, no markup will be output for the filter section.

context:
combined ouput meta HTML
attributes:
This shortcode has no attributes
shortcode example:

To display pagination above and below your view results, you can repeat the wpv-filter-meta-html shortcode:

[wpv-filter-meta-html]
[wpv-layout-meta-html]
[wpv-filter-meta-html]

wpv-noautop

description:

This shortcode disables the auto-paragraph feature for content placed within it.

context:
can be used anywhere
attributes:
This shortcode has no attributes
shortcode example:
[wpv-noautop]
provider: [wpv-post-field name="provider_type"],
industry: [wpv-post-field name="industry"],
featured: [wpv-post-field name="featured_image"]
[/wpv-noautop]

wpv-autop

description:

This shortcode enables the auto-paragraph feature for content placed within it.

context:
can be used anywhere
attributes:
This shortcode has no attributes
shortcode example:
[wpv-autop][types field="full-description"][/types][/wpv-autop]

wpv-filter-start

description:

The wpv-filter-start and wpv-filter-end shortcodes wrap the meta HTML in the Filter section. All pagination and custom search filters need to be wrapped in these two shortcodes. Views will add these shortcodes automatically.

context:
filter meta HTML
attributes:
  • hide: 'true' | 'false' (default)

    Will not be hidden by default

shortcode example:
[wpv-filter-start hide="true"]

wpv-filter-end

description:

The wpv-filter-start and wpv-filter-end shortcodes wrap the meta HTML in the Filter section. All pagination and custom search filters need to be wrapped in these two shortcodes. Views will add these shortcodes automatically.

context:
filter meta HTML
attributes:
This shortcode has no attributes

wpv-layout-meta-html

description:

This shortcode outputs all View results and the meta HTML. It is located in the Filter and Loop Output Integration section of your View.

context:
combined ouput meta HTML
attributes:
This shortcode has no attributes

wpv-layout-start

description:

This shortcode specifies where a Views layout starts.

It is used in the View admin screen when you select or change the View layout using the Loop Wizard. It does not output any HTML.

context:
layout meta HTML (not in loop)
attributes:
This shortcode has no attributes

wpv-layout-end

description:

This shortcode specifies where a Views layout ends.

It is used in the View admin screen when you select or change the View layout using the Loop Wizard. It does not output any HTML.

context:
layout meta HTML (not in loop)
attributes:
This shortcode has no attributes

wpv-items-found

description:

Meta HTML wrapped in [wpv-items-found][/wpv-items-found] will be output if there are any posts | taxonomies | users returned by the View.

This shortcode replaces [wpv-posts-found][/wpv-posts-found] deprecated in Views 1.4.

These shortcodes are added automatically to the Layout Meta HTML when you create a View.

context:
layout meta HTML (not in loop)
attributes:
This shortcode has no attributes
shortcode example:
[wpv-items-found]
Meta HTML displayed when records are found by the View
[/wpv-items-found]

wpv-no-items-found

description:

Content wrapped with [wpv-no-items-found][/wpv-no-items-found] will be output if there are no posts, taxonomies or users returned by the View.

This shortcode replaces [wpv-no-posts-found][/wpv-no-posts-found] deprecated in Views version 1.4.

This shortcode is added automatically to the Layout Meta HTML section when you create a View and features a default “No items found” message.

context:
layout meta HTML (not in loop)
attributes:
This shortcode has no attributes
shortcode example:
[wpv-no-items-found]No users found for this view[/wpv-no-items-found]

wpv-loop

description:

In a View, the code contained between the <wpv-loop></wpv-loop> will be executed once for every post output for the view.

If you use the wrap or pad attributes, you can control the loop output with the [wpv-item] shortcode. You can use the [wpv-item] without wrap or pad.

If you have wpv-item index=2 and padding is not set code that follows will be used only once. In this scenario, it will be used only for the second loop iteration.

If you have wpv-item index=2 and padding is set the code that follows will be used for every second loop iteration. In this scenario, this refers to the second, the fourth, the sixth loop iteration, etc.

Note: Unlike all other Views shortcodes, wpv-loop is wrapped in <> and not [].

Find out more about the loop and attributes available within the loop.

context:
layout meta HTML (not in loop)
attributes:
  • wrap (opt): 'number of items in group'

    Tells Views that we are going to process the posts from our view query, in groups. Posts are still processed one by one, but Views now ‘knows’ that we have a logical grouping of posts

  • pad (opt): 'true' | 'false' (default)

    Enforces the grouping specified in the wrap attribute. If pad=true then the number of times the loop runs will always be multiples of the number specified in the wrap attribute.

shortcode example:
<wpv-loop wrap="4" pad="true">

wpv-loop-index

description:

This shortcode is used to display the current index in a View loop. This shortcode should be used inside a View loop, either directly in the Loop editor or inside a Content Template.

context:
inside the view loop or content template
attributes:
  • accumulate (opt): true | false

    This attribute controls whether the index should remember the item count from a previous page, or start each page with a new fresh index of 1.

  • pad (opt): true | false

    This attribute is used in combination with accumulate attribute. It controls whether the counter in an accumulate="true" should also include pad ghost pseudo-items or not when the View is rendered using a table or Bootstrap grid. In cases when the number of items on each page does not match the number of items that fit into the grid rows holes in the last row would occure.

  • offset (opt): number

    Can be used to move the initial point of the counter. The offset will be added to the current index count. For example, an offset of -1 will make the loop index start at 0 instead of at 1.

shortcode example:
[wpv-loop-index accumulate="false" pad="false" offset="-1"]

wpv-item

description:

Used in the loop. Sets a condition to be met for subsequent lines in the loop to be executed.
If the condition is true, the all subsequent lines will be executed until the next wpv-item shortcode encountered, or the end of the loop.

If you use the wrap or pad attributes for the [wpv-loop] shortcode new loops are generated by the value of wrap. In such scenario wpv-item shortcodes address index items in the wrap loops. An exception is a scenario when you use the split values of wpv-item index. Those values are applied to the entire wpv-loop regardless of the wrapping. They will not be applied if a hardcoded index value of wpv-item is already targetting the split2 item of the loop.

context:
inside the view loop
attributes:
  • index: number-of-post | other | pad | pad-last | split | odd | even | last

    index=1 will target the first record output by the loop.
    index=last will target the last record output by the loop.
    index=other will target all records that do not have a specific index set.
    index=pad will be executed if there are no records left to output, but the number of records is not a multiple of the loop wrap value.
    index=pad-last will be executed for the last item in the loop if are no records left to output, but the number of records is not a multiple of the loop wrap value.
    index=split2 will target the item that falls in the middle of the number of displayed items. In a View displaying 10 or 11 items (set by a limit or pagination), this will target the 5th issue (because it is a “floored middle”).
    index=split3 will target the items that divide the number of results in thirds. On 10 items it will target the 3rd and 6th.
    index=split4 will target the quarter ones. On a 10-results View, it will target the 2nd, the 5th and the 7th.
    index=split5 will target the fifths. Over 10 results, it will target the 2nd, 4th, 6th and 8th ones.
    odd will target odd items, e.g. 1st, 3rd, 5th
    even will target even items, e.g. 2nd, 4th, 6th

shortcode example:
<wpv-loop>
	[wpv-item index=1]
	  Meta HTML to be output for the first item returned by the loop
	[wpv-item index=2]
	  Meta HTML to be output for the second item returned by the loop	  
	[wpv-item index=other]
	  Meta HTML to be output all other items returned by the loop	 
 </wpv-loop>

wpv-heading

description:

Creates a sortable header field for a table.

If you use the table layout wizard in Views, you can select to add sortable headers to the table.

Only Post Fields can be used as sorting criteria.

Read more about the Layout Wizard Table Layout.

context:
inside the view loop or content template
attributes:
  • style (opt): 'style'

    The style of the element. Takes a string value and will be added unchanged to the HTML element

  • class (opt): 'class names separated by space'

    The class of the element. Takes a string value and will be added unchanged to the HTML element

  • name: 'name of the field to be sorted'

    For post fields, this is the shortcode without the wpv- prefix. To sort by [wpv-post-title], name=”post-title”.
    For types field, the field name must be prefixed with types-field. So, to sort by the types field ‘property-name’, name=”types-field-property-name”.

shortcode example:
<table>
	<thead>
		<tr>
			<th>[wpv-heading name="post-title"]Title[/wpv-heading]</th><th>col2</th><th>col3</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>[wpv-post-title]</td><td>col2</td><td>col3</td>
		</tr>
	</tbody>
</table>

Will display a table which is sortable by the first column, post title. The column header, can be clicked to sort ascending or descending.

wpv-for-each

description:

Iterate through multiple items in a post meta field and output the enclosed text for each item. Including Types repeating fields.

Note: wpv-conditional shortcode won’t work inside a wpv-for-each shortcode

context:
inside the view loop or content template
attributes:
  • field: 'custom field name'

    The custom field name we are going to filter the view by. This will be one of your Types Custom fields.

  • start (opt): 'number'

    start=”2″ will start the wpv-for-each loop on the second element

  • end (opt): 'number'

    end=”3″ will end the wpv-for-each loop on the third element

  • separator: string

    A separator that will be placed between each field value.

shortcode example:

Output a repeating types field values as an ordered list

<ol>[wpv-for-each field="wpcf-my-field"]<li>[types field="my-field"][/types]</li>[/wpv-for-each]</ol>

Output custom 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>

wpv-conditional

Modified v1.4

description:

Conditional shortcode to be used to display a specific block of meta HTML based on results of a boolean expression . If the expression is true, then the meta HTML between the [wpv-conditional][/wpv-conditional] shortcodes will be executed.

Inside the evaluation expression, you can use any of the following:

  • Types fields
  • Custom fields
  • Views shortcodes
  • Custom functions, that had been already registered in Views -> Settings
  • Integer and floating-point numbers
  • Strings wrapped inside single quotes
  • Math operators: +, -, *, /
  • Comparison operators: < or lt, > or gt, = or eq, <= or lte, >= or gte, != or ne
  • Boolean operators: AND, OR, NOT
  • Nested expressions using several levels of parentheses
context:
inside the view loop or content template
attributes:
  • evaluate (opt): true | false

    It can be set to true or false and controls whether we want the condition to be met or not. The default value is true.

  • if:

    It is the evaluation string and holds the actual condition to evaluate

  • debug (opt): true | false

    Will output debug information for your [wpv-if] statement. The default value is false.

shortcode example:
[wpv–conditional if="('1' eq '1')"]This is some text[/wpv–conditional]

Checking a custom field:

[wpv–conditional if="( $(test-custom-field) eq 'my value' )"]This field has value "my value"[/wpv–conditional]

Checking a Types field:

[wpv–conditional if="( $(wpcf-test-field) eq 'my value' )"]This field has value "my value"[/wpv–conditional]

Checking for empty fields:

[wpv-conditional if="( empty($(wpcf-test-field)) )"]This field is empty or does not exist[/wpv-conditional]

Evaluating results of a class method:

[wpv-conditional if="( MyClass::my_method() eq 'hello' )"]This function returns hello[/wpv-conditional]

Evaluating results of a custom function:

[wpv-conditional if="( my_custom_function() eq 'hello' )"]This function returns hello[/wpv-conditional]

Read more about Conditional HTML output in your views.

Displaying content

wpv-view

description:

Will render the view on your page, post or in another view or Content template.

You can add custom attributes to the shortcode to pass your own arguments to the view.

context:
page, view loop, custom post type
attributes:
  • cached (opt): off

    Turns off the caching system for the View.

  • limit (opt): 'amount of results'

  • offset (opt): 'amount of results to skip'

  • orderby (opt): 'field-xxx' | 'include'

    You can sort by a custom field simply using the value field-xxx where xxx is the custom field slug.

    Only in case of Views listing users, you can also sort by ‘include’, which will apply the order set by a query filter that includes specific users, or default to the user login name sorting if that filter is not set.

  • orderby_as (opt): 'string' | 'numeric'

    When you sort by a post field on Views listing posts or a termmeta field on Views listing terms, you can also set an ‘orderby_as’ attribute that can be ‘string’ or ‘numeric’.

  • order (opt): 'asc' (default) | 'desc'

  • name: 'name of the view to be displayed' | 'slug of the view to be displayed'

    It is recommended to use view name rather than view slug.

shortcode example:
[wpv-view name="My amazing custom post list"]

If you want to turn off cache for this View, you can use the cached argument:

[wpv-view name="My amazing custom post list" cached="off"]

If you want to override the settings of the View, you can use the following arguments:

[wpv-view name="my-view" limit="50" offset="15" orderby="field-publishing-date" order="desc"]

If you want to order by a custom list of users, you can use the following arguments:

[wpv-view name="users" users="3,10,7,3" orderby="include"]

wpv-form-view

description:

You can use wpv-form-view shortcode when you want to display only the Search form for a View. You can choose whether to display search results on the same page or on some other page. For displaying results please take a look at the Displaying content section.

context:
page, view loop, custom post type
attributes:
  • name: 'name of the View'

  • target_id: 'page_ID' | 'self'

    Use the ‘page_ID’ to set the ID of the target page where the view results will be displayed. The ‘self’ value indicates that the results will be displayed on the current page

shortcode example:

If you want to display results on the current page use target_id="self":

[wpv-form-view name="search-the-projects" target_id="self"]

If you want to display results on other page use the page ID of the target page:

[wpv-form-view name="search-the-projects" target_id="1485"]

Displaying data

wpv-items-count

description:

Outputs the number of posts, users or taxonomies 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.

(Compare with [wpv-found-count] – this will output the total number of post returned by the Views query)

This shortcode replaces [wpv-post-count] deprecated in Views V1.3.1.

context:
layout meta HTML (not in loop)
attributes:
This shortcode has no attributes
shortcode example:

Showing [wpv-items-count] posts of [wpv-found-count] posts found.

wpv-found-count

description:

Displays the total number of posts, users or taxonomies 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.

Compare with [wpv-items-count] which will output the number of records on the page.

context:
layout meta HTML (not in loop)
attributes:
This shortcode has no attributes
shortcode example:

Showing [wpv-items-count] posts of [wpv-found-count] posts found.

wpv-post-id

description:

Outputs the ID for the current post

context:
inside the view loop or content template
attributes:
  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

shortcode example:
ID is [wpv-post-id]

wpv-post-title

description:

Output’s the current post’s title.

context:
inside the view loop or content template
attributes:
  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

  • output (opt): 'raw' | 'sanitize'

    output=”sanitize” will let you use the post title as HTML atrributes

shortcode example:
<h2>[wpv-post-title]</h2>

wpv-post-slug

description:

Outputs the slug for the current post

context:
inside the view loop or content template
attributes:
  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

shortcode example:
The slug is [wpv-post-slug]

wpv-post-link

description:

Outputs the current post’s title as a link to the post

context:
inside the view loop or content template
attributes:
  • style (opt): 'style'

    The style of the element. Takes a string value and will be added unchanged to the HTML element

  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

  • class (opt): 'class names separated by space'

    The class of the element. Takes a string value and will be added unchanged to the HTML element

shortcode example:
Permalink to [wpv-post-link]

wpv-post-read-more

description:

Outputs a link to read more content of the post.

context:
attributes:
  • style (opt): 'style'

    The style of the element. Takes a string value and will be added unchanged to the HTML element

  • label (opt):

    Use this attribute to set the label of the link. It defaults to Read more.

  • wpml_context (opt):

    If the site is multilingual use this attribute to set the context in which the label will be registered in WPML String Translation.

  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

  • class (opt): 'class names separated by space'

    The class of the element. Takes a string value and will be added unchanged to the HTML element

shortcode example:
[wpv-post-read-more label="Continue reading"]

wpv-post-url

description:

Outputs the URL to the current post.

context:
inside the view loop or content template
attributes:
  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

shortcode example:
<a href="[wpv-post-url]">link to the current post</a>

wpv-post-menu-order

description:

Outputs the menu order of the post.

context:
inside the view loop or content template
attributes:
  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

shortcode example:
[wpv-post-menu-order]

wpv-post-body

description:

Outputs the content of the current post or renders a content template

context:
inside the view loop or content template
attributes:
  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

  • view_template: 'content template name' | 'content template slug' | 'None'

  • suppress_filters (opt): 'true' | 'false' (default)

    If suppress_filters=’true’, all third party (non WordPress) filters hooked into the_content filter will be removed, when retrieving the post body. In certain circumstances, plugins using this filter can add duplicated content to the post body – removing the filters can resolve this problem.

  • output (opt): 'normal' | 'raw' | 'inherit'

    sets if the post body coming from a [wpv-post-body view_template=”None”] shortcode should add formatting (normal), disable formatting (raw) or inherit it from the parent Content Template (inherit)

shortcode example:
[wpv-post-body view_template="None"]

wpv-post-excerpt

description:

Display the excerpt of the current post

context:
inside the view loop or content template
attributes:
  • format (opt): 'autop' | 'noautop'

    Controls whether the excerpt will be wrapped in paragraph tags or not. Defaults to autop.

  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

  • length (opt): 'Number of characters or words to be displayed'

    default length is 252 characters or the excerpt length defined by the theme.
    Since v1.5.1 this length parameter is applied to manual excerpts too.

  • count (opt): 'char' | 'word'

    sets if the length attribute is to be applied on characters or words.

  • more (opt): 'Text to be displayed'

    sets the text to be used when the excerpt is being trimmed and defaults to ‘…’ or the value set by the theme.

shortcode example:
[wpv-post-excerpt length="30" count="word" more=" - ..."]

wpv-post-field

description:

Output a custom field for the current post.

This displays the raw data from the field. Use the Types plugin the and the [types] shortcode to display formatted fields.

context:
inside the view loop or content template
attributes:
  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

  • name: 'field name'

    The name of the custom field to display (including wpcf- prefix)

  • index (opt): 'zero based array 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 (opt): 'string separator for multiple values'

    Default value is comma followed by a space

shortcode example:
[wpv-post-field name="wpcf-my-types-custom-field"]

wpv-post-author

description:

Display details for the author of the current post.

context:
inside the view loop or content template
attributes:
  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

  • format: 'name' (default) | 'link' | 'url' | 'meta' | 'profile_picture'

  • meta (opt): 'WordPress the_author_meta field'

    If format=”meta”, meta can take any of the WordPress the_author_meta fields.

  • profile-picture-size (opt): 'size in pixels'

  • profile-picture-shape (opt): 'circle' (default) | 'square'

  • profile-picture-alt (opt): 'alt attribute of the image HTML tag'

  • profile-picture-default-url (opt): 'URL'

    Default image to use in case the current post author does not have any defined profile picture. Defaults to the one set in the WordPress settings.

shortcode example:
Post author likes to be known as [wpv-post-author format="meta" meta="nickname"]

wpv-post-featured-image

Modified v1.4

description:

Outputs the featured image for the current post.

If the data attribute is set, just the value for the data item will be returned, not the image.

Please note that if the site was moved from HTTP to HTTPS (i.e. SSL usage) this shortcode will still be outputting the HTTP links for the image. Click here to read more about this issue and its current workaround.

context:
inside the view loop or content template
attributes:
  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

  • class (opt): 'class names separated by space'

    The class of the element. Takes a string value and will be added unchanged to the HTML element

  • output (opt): 'img' | 'url' | 'alt' | 'id' | 'author' | 'date' | 'description' | 'title' | 'caption'

    Display additional information for the image.

    -img option displays an image HTML tag

    -url option displays the URL of the image

    -alt id author date description title caption options display the metadata set by that key

    Default value is ‘img’.

  • attr (opt): 'query-string-like value'

    Will only work when displaying the full img HTML tag and expects a query-string-like value: attr=”title=a&alt=b&classname=c” will add those attributes to the img HTML tag

  • size (opt): 'thumbnail' (default) | 'medium' | 'large' | 'full' | 'custom'

  • width (opt):

    The width of an image in pixels, when custom size attribute is set.

  • height (opt):

    The height of an image in pixels, when custom size attribute is set.

  • crop (opt): 'false' | 'true'

    Enable or disable the cropping of an image with custom size. False value is the default one.

  • crop_horizontal (opt): 'left' | 'center' | 'right'

    Defines the horizontal crop position for images with custom size.

  • crop_vertical (opt): 'top' | 'center' | 'bottom'

    Defines vertical crop position for images with custom size.

shortcode example:
[wpv-post-featured-image size="medium" raw="false"]

[wpv-post-featured-image attr="class=my-custom-class"]

[wpv-post-featured-image size='custom' width='300' height='200']

[wpv-post-featured-image size='custom' width='300' height='200' crop='true' crop_horizontal='right' crop_vertical='bottom']

wpv-post-date

Modified v1.5

description:

Outputs the post date for the current post. If format is not set, this will default to the date format set in WordPress general settings.

context:
inside the view loop or content template
attributes:
  • type (opt): created (default) | modified

    It defines if the creation or modification date will be printed by the shortcode.

  • format (opt): Any valid WordPress date format. Defaults to WordPress General Settings format

shortcode example:
Published on [wpv-post-date format="F jS, Y"]

Modified on [wpv-post-date type="modified"]

wpv-post-comments-number

description:

Displays the number of comments for the current post

context:
inside the view loop or content template
attributes:
  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

  • 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”

shortcode example:
This post has [wpv-post-comments-number none='No Comments' one='1 Comment' more='% Comments']

wpv-post-type

description:

Outputs the post plural name, singular name and slug.

context:
inside the view loop or content template
attributes:
  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

  • show: 'slug' (default) | 'single' | 'plural'

shortcode example:
[wpv-post-type show="single"]

wpv-post-status

description:

This shortcode displays the current post status. Views returns the WordPress posts status as one of the following strings:
publish, future, draft, pending, private, trash, auto-draft, inherit

context:
inside the view loop or content template
attributes:
  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

shortcode example:
This post has a status of [wpv-post-status]

wpv-post-taxonomy-iterator

description:

Use this shortcode to loop over terms associated to the current post. Any taxonomy-related shortcode will return the right data for each term in the iteration. Shortcodes like [types termmeta=”termmeta-slug”][/types] or [wpv-taxonomy-title] will be replaced, each time, with the right data for each term.

context:
inside the view loop or content template
attributes:
  • taxonomy:

    must hold the slug of the taxonomy to loop over. For example, taxonomy="category".

  • separator (opt): string

    A separator that will be used to separate the different values for each term associated with the current post. Defaults to an empty string.

  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

shortcode example:

Show an unordered list of titles for categories assigned to the current post.


<ul>[wpv-post-taxonomy-iterator]<li>[wpv-taxonomy-title]</li>[/wpv-post-taxonomy-iterator]</ul>

wpv-post-taxonomy

description:

Output the taxonomy for the current post.

context:
inside the view loop or content template
attributes:
  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

  • separator (opt): 'string separator for multiple values'

    Default value is comma followed by a space

  • type: 'slug of the taxonomy to be displayed'

    You can pass multiple taxonomies, as a comma-separated list, to render terms from more than one taxonomy at the same time.

  • format (opt): 'link' (default) | 'url' | 'name' | 'description' | 'slug' | 'count'

    What to display.

  • show (opt): 'name' (default) | 'description' | 'slug' | 'count'

    When format=”link”, you can select what text will be used as the anchor text.

  • order (opt): 'asc' (default) | 'desc'

shortcode example:
Filed under [wpv-post-taxonomy type="category" separator=", " format="link" show="name" order="asc"]

wpv-post-edit-link

description:

Displays an edit link to the current post.

context:
inside the view loop or content template
attributes:
  • style (opt): 'style'

    The style of the element. Takes a string value and will be added unchanged to the HTML element

  • item (opt): The “item” attribute is used to get the context when retrieving data from a post that is different from the current one.

  • class (opt): 'class names separated by space'

    The class of the element. Takes a string value and will be added unchanged to the HTML element

  • text (opt): 'Link text'

    Set the text for the link. If left blank, the link text will be ‘Edit this’ by default.

shortcode example:
[wpv-post-edit-link text='Edit this post']

wpv-post-class

description:

Displays the CSS classnames related to the current post.

context:
inside the view loop or content template
attributes:
  • add (opt): 'Space separated list of classnames to be added'

shortcode example:
<div class="[wpv-post-class add='my-classname']">
    <!-- Do some stuff here -->
</div>

wpv-taxonomy-title

description:

Outputs the taxonomy title as a plain text.

When this shortcode is used inside a taxonomy archive page, by default, it will return data from the term shown in the archive.

context:
inside a taxonomy view loop
attributes:
  • term_id (opt):

    Sets the specific term ID for which you want to display the data.

shortcode example:
[wpv-taxonomy-title]

wpv-archive-title

description:

This shortcode displays the title of the WordPress archive page.

context:
inside the view loop or content template
attributes:
This shortcode has no attributes
shortcode example:
[wpv-archive-title]

On a yearly archive page, this will output “Year: 2015” (for example).
On an archive page for the “Events” Custom Post Type, this will output “Archive: Events”.

wpv-attribute

description:

This shortcode displays the value of an attribute in a View shortcode.

context:
inside the view loop
attributes:
  • name: The name of the shortcode attribute

shortcode example:

If you are using a Views shortcode like this:

[wpv-view name="houses" location="Boston"]

You can access the value of the location attribute with this shortcode:

[wpv-attribute name="location"]

This will display Boston.

wpv-taxonomy-field

description:

Output a custom field for a taxonomy term.

This displays the raw data from the field. Use the Types plugin the and the [types] shortcode to display formatted fields.

When this shortcode is used inside a taxonomy archive page, by default, it will return data from the term shown in the archive.

context:
inside the view loop or content template
attributes:
  • term_id (opt):

    Sets the specific term ID for which you want to display the data.

  • name: 'field name'

    The name of the custom field to display (including wpcf- prefix)

  • index (opt): 'zero based array 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 (opt): 'string separator for multiple values'

    Default value is comma followed by a space

shortcode example:
[wpv-taxonomy-field name='wpcf-my-custom-taxonomy-field']

wpv-taxonomy-slug

description:

Outputs the taxonomy slug.

When this shortcode is used inside a taxonomy archive page, by default, it will return data from the term shown in the archive.

context:
inside a taxonomy view loop
attributes:
  • term_id (opt):

    Sets the specific term ID for which you want to display the data.

shortcode example:
[wpv-taxonomy-slug]

wpv-taxonomy-url

description:

Display the taxonomy URL as a plain text (not embedded in a HTML link).

When this shortcode is used inside a taxonomy archive page, by default, it will return data from the term shown in the archive.

context:
inside a taxonomy view loop
attributes:
  • term_id (opt):

    Sets the specific term ID for which you want to display the data.

shortcode example:
[wpv-taxonomy-url]

wpv-taxonomy-description

description:

Outputs the taxonomy description text.

When this shortcode is used inside a taxonomy archive page, by default, it will return data from the term shown in the archive.

context:
inside a taxonomy view loop
attributes:
  • term_id (opt):

    Sets the specific term ID for which you want to display the data.

shortcode example:
[wpv-taxonomy-description]

wpv-taxonomy-post-count

description:

Output the number of posts for the current taxonomy.

When this shortcode is used inside a taxonomy archive page, by default, it will return data from the term shown in the archive.

context:
inside a taxonomy view loop
attributes:
  • term_id (opt):

    Sets the specific term ID for which you want to display the data.

shortcode example:
[wpv-taxonomy-post-count]

wpv-user

description:

Display user info. If the shortcode is inside a Views user query, it will display information for the user found in loop. Otherwise it will display information for the current logged-in user or the user with the specific id, when id attribute is set.

context:
can be used anywhere
attributes:
  • id (opt): 'user-id'

    wpv-user will display data for the user with a specific id, when id attribute is passed to it.

  • field (opt): 'display_name' (default) | 'profile_picture' | 'ID' | 'user_login' | 'user_firstname' | 'user_lastname' | 'nickname' | 'nicename' | 'user_email' | 'user_url' | 'user_registered' | 'spam' | 'custom user field name'

    When specifying a custom field name, make sure to use the full field slug e.g field=’wpcf-custom-user-field’

    Find out more about user fields.

  • size (opt): 'size in pixels'

  • default-url (opt): 'URL'

    Default image to use in case the current post author does not have any defined profile picture. Defaults to the one set in the WordPress settings.

  • shape (opt): 'cirle' (default) | 'square'

  • alt (opt): 'alt attribute of the image HTML tag'

shortcode example:
[wpv-user field="description"]

Display bio for user returned by Views loop or the current user if outside a loop.

[wpv-user field="wpcf-custom-user-field"]

Display a custom user field added by Types

[wpv-user field="user_email" id="123456"]

Display the email value for the the user with ID 123456.

wpv-theme-option

description:

Displays values from registered keys of a registered framework.

context:
can be used anywhere
attributes:
  • name: 'option-name'

    The name of the framework option that we want to fetch.

  • separator (opt): 'string separator for multiple values'

    Default value is comma followed by a space

shortcode example:

[wpv-theme-option name="key" separator=", "]

Displays the values of option with name “key”, separated by commas.

Filter controls

wpv-filter-controls

description:

This shortcode contains all the controls and display elements for a custom search form. All custom search controls must be wrapped in the [wpv-filter-controls][/wpv-filter-controls] shortcode.

context:
filter meta HTML
attributes:
  • hide: 'true' | 'false' (default)

    Will not be hidden by default

shortcode example:
[wpv-filter-controls hide='true']

For more information about filter controls, Custom  search – Letting Visitors Filter Content

wpv-control

Modified v1.5

description:

This shortcode will output filter controls for your custom searches.

When you add filter controls in your Filter Meta HTML, the matching URL parameters will be added to your View Filter.

Custom search – Letting visitors filter content

context:
filter meta HTML
attributes:
  • label_class (opt):

    The class of the input label.

  • label_style (opt):

    The inline style of the input label.

  • taxonomy (opt): 'slug of the taxonomy to be displayed'

    It will display ‘select’ control type by default. Taxonomy can also be displayed as ‘checkboxes’ type.

  • hide_empty (opt): 'true' | 'false' (default)

    Applies to filtering by Taxonomy. If true, empty taxonomies will not be displayed.

  • default_date (opt): 'any of the Toolset date filters' (default TODAY()) | 'NONE'

  • date_format (opt): 'WordPress date format'

    Αpplicable for a datepicker control – format will default to WordPress General Settings. Use WordPress date formats.

  • default_label (opt): 'default option text'

    Add default option like All or Any on taxonomy select control.

  • format (opt): '%%COUNT%% %%NAME%%'

    %%COUNT% will display the number of post for the taxonomy term and %%NAME%, the taxonomy term.
    e.g. format=’%%NAME%% (%%COUNT%%)’

  • taxonomy_order (opt): ASC (default) | DESC

    Taxonomy display order.

  • taxonomy_orderby (opt): 'count' | 'id' | 'name' (default) | 'none' | 'slug' | 'term_group'

    Set the display order for taxonomy terms.

  • field: 'custom field name'

    The custom field name we are going to filter the view by. This will be one of your Types Custom fields.

  • title: 'checkbox title'

    Only applicable to the checkbox control type.

  • auto_fill_sort (opt): 'asc' (default) | 'desc' | 'ascnum' | 'descnum' | 'none'

  • auto_fill_default (opt): 'text to be displayed as the default option'

    Used to set the default value of the control. If the value is not one of the control values, the value will be placed as the first entry – good for ‘All’ or ‘Select any’ defaults.

  • auto_fill (opt): 'slug of the field used to populate control options'

    Will populate a select, multi-select, radios, checkboxes will database values for a specific custom field.
    The filed slug with the wpcf- prefix must be used.

  • display_values (opt): comma separated list of option display values

    For select, multi-select, radios and checkboxes controls.

    Works in conjunction with the values attribute.

    Number of entries for the display_values attribute must match the number of entries for the values attribute.

    %%COMMA%% can be used to force commas in the display values (e.g. 2,3%%COMMA%%1,4) would display option values of 2 and 3,1 and 4.

  • values (opt): comma separated list of option values

    for select, multi-select, radios and checkboxes controls.

    Words in conjunction with the display_values attribute.

  • type (opt): 'checkbox' | 'checkboxes' | 'date' | 'datepicker' | 'radios' | 'select' | 'textfield' | 'multi-select'

    Control type to be displayed on your Custom search form. Defaults to the appropriate control type for the field type.

  • url_param: 'URL parameter name'

wpv-control-postmeta

description:

This shortcode is used in your custom searches and outputs the front-end filter controls by a custom post field.

When you add filter controls in the Filter Editor, the matching URL parameters will be added to your View filter.

Custom search – Letting visitors filter content

context:
filter meta HTML
attributes:
  • output: 'bootstrap' (default)

    Defines the type of output to generate. In general, it produces a dedicated HTML structure on complex filters (like radios or checkboxes) and adds certain class names to simple filters (select, multi-select, and textfield). Defaults to bootstrap.

  • order (opt): 'asc' (default) | 'desc' | 'ascnum' | 'descnum' | 'none'

    The order in which options are offered. Works only for values coming from the database.

    Please note that currently, it is not possible to use this attribute to sort the values defined in a Types fields that feature options (select, radios, and checkboxes).

  • source (opt): 'database' | 'custom'

    Defines the origin of the offered values to offer. Can be database or custom.

    The first option loads the existing values from the database. The second option uses the values and labels, passed using the values and display_values attributes.

  • style (opt): 'style'

    The style of the element. Takes a string value and will be added unchanged to the HTML element

  • label_class (opt):

    The class of the input label.

  • label_style (opt):

    The inline style of the input label.

  • class (opt): 'class names separated by space'

    The class of the element. Takes a string value and will be added unchanged to the HTML element

  • date_format (opt): 'WordPress date format'

    Αpplicable for a datepicker control – format will default to WordPress General Settings. Use WordPress date formats.

  • default_date (opt): 'any of the Toolset date filters' (default TODAY()) | 'NONE'

  • field: 'custom field name'

    The custom field name we are going to filter the view by. This will be one of your Types Custom fields.

  • default_label (opt): 'default option text'

    Add default option like All or Any on taxonomy select control.

  • format (opt): '%%COUNT%% %%NAME%%'

    %%COUNT% will display the number of post for the taxonomy term and %%NAME%, the taxonomy term.
    e.g. format=’%%NAME%% (%%COUNT%%)’

  • title: 'checkbox title'

    Only applicable to the checkbox control type.

  • display_values (opt): comma separated list of option display values

    For select, multi-select, radios and checkboxes controls.

    Works in conjunction with the values attribute.

    Number of entries for the display_values attribute must match the number of entries for the values attribute.

    %%COMMA%% can be used to force commas in the display values (e.g. 2,3%%COMMA%%1,4) would display option values of 2 and 3,1 and 4.

  • values (opt): comma separated list of option values

    for select, multi-select, radios and checkboxes controls.

    Words in conjunction with the display_values attribute.

  • type (opt): 'checkbox' | 'checkboxes' | 'date' | 'datepicker' | 'radios' | 'select' | 'textfield' | 'multi-select'

    Control type to be displayed on your Custom search form. Defaults to the appropriate control type for the field type.

  • url_param: 'URL parameter name'

wpv-control-post-taxonomy

description:

This shortcode is used in your custom searches and outputs the front-end filter controls by a custom taxonomy.

When you add filter controls in the Filter Editor, the matching URL parameters will be added to your View filter.

Custom search – Letting visitors filter content

context:
filter meta HTML
attributes:
  • label_style (opt):

    The inline style of the input label.

  • label_class (opt):

    The class of the input label.

  • style (opt): 'style'

    The style of the element. Takes a string value and will be added unchanged to the HTML element

  • output: 'bootstrap' (default)

    Defines the type of output to generate. In general, it produces a dedicated HTML structure on complex filters (like radios or checkboxes) and adds certain class names to simple filters (select, multi-select, and textfield). Defaults to bootstrap.

  • taxonomy: 'taxonomy slug'

    The taxonomy slug used to filter by. Mandatory.

  • order (opt): 'ASC (default)' | 'DESC'

    Taxonomy display order.

  • orderby (opt): 'name' (default) | 'count' | 'id' | 'none' | 'slug' | 'term_group'

    Set the display order for taxonomy terms.

  • class (opt): 'class names separated by space'

    The class of the element. Takes a string value and will be added unchanged to the HTML element

  • url_param: 'URL parameter name'

  • type (opt): 'checkbox' | 'checkboxes' | 'date' | 'datepicker' | 'radios' | 'select' | 'textfield' | 'multi-select'

    Control type to be displayed on your Custom search form. Defaults to the appropriate control type for the field type.

  • format (opt): '%%COUNT%% %%NAME%%'

    %%COUNT% will display the number of post for the taxonomy term and %%NAME%, the taxonomy term.
    e.g. format=’%%NAME%% (%%COUNT%%)’

  • default_label (opt): 'default option text'

    Add default option like All or Any on taxonomy select control.

wpv-control-set (legacy)

description:
This is documentation for the legacy shortcode. Use wpv-control-post-relationship instead.

This shortcode is a wrapper for the [wpv-control-item] shortcodes generated when displaying a custom search that uses a filter by post relationship.

It has some attributes that hold important data for those inner shortcodes.

context:
filter meta HTML
attributes:
  • url_param: 'URL parameter name'

  • ancestors: 'post ancestors tree'

    post ancestors that will be displayed in this filter, in a >-separated list

wpv-control-post-relationship

description:

This shortcode is a wrapper for the wpv-control-post-ancestor shortcodes generated when displaying a custom search that uses a filter by post relationship.

It has certain attributes that hold important data for those inner shortcodes.

context:
filter meta HTML
attributes:
  • url_param: 'URL parameter name'

  • ancestors: 'post ancestors tree'

    post ancestors that will be displayed in this filter, in a >-separated list

wpv-control-item (legacy)

description:
This is documentation for the legacy shortcode. Use wpv-control-post-ancestor instead.

This shortcode displays each ancestor input for a custom search that uses a filter by post relationship.

context:
filter meta HTML
attributes:
  • label_style (opt):

    The inline style of the input label.

  • label_class (opt):

    The class of the input label.

  • type: 'select' | 'multi-select' | 'radios' | 'checkboxes'

  • ancestor_type: 'post type slug'

    ancestor slug that this shortcode will generate the input for

  • default_label (opt): 'default option text'

    adds a default option like All, Any or Select one on a select control.

wpv-control-post-ancestor

description:

This shortcode displays an input for each ancestor in a custom search that uses a filter by post relationship.

context:
filter meta HTML
attributes:
  • label_style (opt):

    The inline style of the input label.

  • label_class (opt):

    The class of the input label.

  • output: 'bootstrap' (default)

    Defines the type of output to generate. In general, it produces a dedicated HTML structure on complex filters (like radios or checkboxes) and adds certain class names to simple filters (select, multi-select, and textfield). Defaults to bootstrap.

  • type: 'select' | 'multi-select' | 'radios' | 'checkboxes'

  • ancestor_type: 'post type slug'

    ancestor slug that this shortcode will generate the input for

  • default_label (opt): 'default option text'

    adds a default option like All, Any or Select one on a select control.

wpv-filter-submit

Modified v1.4

description:

Adds a submit button to a Custom search form.

context:
filter meta HTML
attributes:
  • style (opt): 'style'

    The style of the element. Takes a string value and will be added unchanged to the HTML element

  • class (opt): 'class names separated by space'

    The class of the element. Takes a string value and will be added unchanged to the HTML element

  • hide: 'true' | 'false' (default)

    Will not be hidden by default

  • name: 'button text'

shortcode example:
[wpv-filter-submit name="Search" class="my-button"]

wpv-filter-reset

description:

Adds a clear or reset button to a Custom search form.

context:
filter meta HTML
attributes:
  • style (opt): 'style'

    The style of the element. Takes a string value and will be added unchanged to the HTML element

  • class (opt): 'class names separated by space'

    The class of the element. Takes a string value and will be added unchanged to the HTML element

  • reset_label (opt): 'button text'

shortcode example:
[wpv-filter-reset reset_label="Clear" class="my-button"]

wpv-filter-spinner

description:

Will display a spinner attached to a container that can be used in custom overlays when automatically updating Views results on a custom search. Note that this shortcode must be closed.

context:
filter meta HTML
attributes:
  • style (opt): 'style'

    The style of the element. Takes a string value and will be added unchanged to the HTML element

  • class (opt): 'class names separated by space'

    The class of the element. Takes a string value and will be added unchanged to the HTML element

  • container (opt): 'span' | 'div' | 'p'

    whether the container is a span, a division or a paragraph

  • position (opt): 'before' | 'after' | 'none'

    whether the spinner will be added at the begining or end of the container, or will be hidden

shortcode example:
[wpv-filter-spinner container="div" class="myclassname" position="before"]My content[/wpv-filter-spinner]

Translating

wpml-string

description:

The wpml-string shortcode assists in building multilingual sites with the help of the Toolset and WPML plugins. It allows you to register strings for translation in WPML’s String translation and displays the translations.

See full description.

context:
attributes:
  • contex (opt):

    This controls the domain under which the string will be registered and appears in the WPML String translation screen. The domain is used to helps group related strings, so that it is easier to find and translate them. If not provided, the context will be created automatically

  • name (opt):

    This controls the name under which the string will be registered and appears in the WPML String translation. A custom name helps a WPML user identify the relevant string in the WPML String translation screen, especially if you register a few strings with the same context attribute and with the same value, but with different translations (e.g., “comment” can be used both as a verb or a noun). If not provided, the name will be created automatically and will start with the wpml-shortcode prefix followed by a unique identifier based on the value passed in the shortcode content.

shortcode example:
[wpml-string context='wpv-views']Read more[/wpml-string]
  1. Registers the ‘Read more’ string in the WPML String translation admin screen under the wpv-views domain, provided the “Read more” string did not exist within that domain yet.
  2. Displays “Lire la suite” in the French version of the page and “Leer más” in the Spanish version, provided that “Lire la suite” and “Leer más” are French and Spanish translations, respectively, of the “Read more” string, for the wpv-views domain and both translations are marked as completed in the WPML String translation admin screen.
    1. See more examples

wpml-lang-switcher

description:

This shortcode takes no attributes and displays a language switcher as produced by the WPML API hook.

context:
can be used anywhere
attributes:
This shortcode has no attributes

wpml-sidebar

description:

This shortcode takes no attributes and displays a navigation control for the current post, and requires the WPML CMS Nav addon.

context:
attributes:
This shortcode has no attributes

wpml-conditional

description:

Takes a single attribute lang that has a value of a language code as stored in WPML. It returns the shortcode content conditionally when the current language matches the attribute value one.

context:
attributes:
This shortcode has no attributes