tip – usefull standard shortcodes

There are some standard Toolset shortcodes that I use very often. All of them are included on the Views shortcodes list of Toolset Documentation.

Some of these shortcodes are not available on Views GUI, so if you need them you have to look for them on Documentation. Some other are on the GUI, but sometimes it is not so fast to include them by the Views GUI. Usually the GUI print them with double quotes inside (ex: [wpv-bloginfo show=”wpurl”], but sometimes I need them with single quotes, for example, to include them in a link “href” attribute or in a Toolset wpv-conditional shortcode.

So, this is my list:

Website URL to include in a <a href=””> or <img src=””> tags:

[wpv-bloginfo show='wpurl']


<a href="[wpv-bloginfo show='wpurl']">My Site</a>



Access the value of any View shortcode attribute:

[wpv-attribute name='view-attribute']



Access the value of any URL parameter:

[wpv-search-term parm='url-param']



Get number of posts on the current paginated page and get the total number of posts in the loop:

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



Sometimes I build a View to get a simple array of values, for example, a list of post IDs separated by commas. Usually I need it this to pass the result in a another view attribute, so I need a clean and no spacing output, like “34,56,78,90”. I use this code in the view loop editor:

[wpv-layout-start][wpv-items-found]<!-- wpv-loop-start --><wpv-loop>[wpv-item index=1][wpv-post-id][wpv-item index=other],[wpv-post-id]</wpv-loop><!-- wpv-loop-end -->[/wpv-items-found][wpv-no-items-found][/wpv-no-items-found][wpv-layout-end]


Don’t forget to check the option “Disable the wrapping DIV around the View”, so you get a completely clean output:

Disable the wrapping DIV around the View

This is a list of shortcodes to get users data that I often need with single quotes to use inside wpv-conditional:

[wpv-post-author format='meta' meta='ID']


[wpv-current-user info='role']


[wpv-current-user info='id']


[wpv-current-user info='logged_in']



For example to display something only to logged in users:

[wpv-conditional if="( '[wpv-current-user info='logged_in']' eq 'true' )"][/wpv-conditional]



Get the complete list of Views shortcode here:

https://toolset.com/documentation/user-guides/views/views-shortcodes/

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>