Shortcode options

The following are a list of more advanced options for the display shortcode

  • [wpinventory category_name="Your category name here"]

    – This shortcode attribute will show all inventory items associated with a category given the category name is 100% identical to the category name you want to use to display.  Meaning, uppercase and spaces and punctuation all the same.

  • [wpinventory category_slug="category-slug"]

    – This is the slug of the category as defined in the dashboard under the category you setup.  To edit the slug simply navigate to the WordPress dashboard under the WP Inventory tab and “Categories”.  Editing the category will give you the ability to change the slug.  This enables you to manager your category names and the slugs for the URLs you want to use separately.

  • [wpinventory category_id="5,7,12"]

    – Using this attribute will allow you to display only one category at a time, or multiple categories.  To display only one category, just put in that category ID and that is it.  To display multiple categories, simply separate each ID with a comma.

  • [wpinventory inventory_id="175"]

    – The attribute inventory_id will show only that one inventory item.  Put this on individually made inventory pages for example.

  • [wpinventory product_id="175"]

    – Alias for inventory_id above, this does the same exact thing.  It allows you to list one specific item.  In this case the attribute is specific to the point it is a “product”.  You may pick which you prefer to use.

  • [wpinventory inventory_slug="product-slug"]

    – Another way to list one item specifically.  Using it’s inventory slug label.

  • [wpinventory user_id="5"]

    – Here we can show all inventory items on a page associated to the user “x”. Meaning, all inventory items entered by that specific user and that user alone. You will have to know the user’s ID for this. You can find that by hovering the user in the WordPress dashboard under the “users” tab. When you hover that user, at the bottom of your screen it should show the URL of that user link. In that URL, you will see “user_id=”x”. That is the id you need for this shortcode attribute to work. Also, you will not be able to see your own personal user ID while you are logged in. WordPress just does not show it to you. So, you need to log in as another user. If you are the only user or, were the first user, then your user ID is “1”.

  • [wpinventory page="3"]

    – A numeric value to indicate which page in the number of pages to view.

  • [wpinventory page_size="15"]

    – A numerical value to set how many items to display on a page before having to go to the next page.

  • [wpinventory inventory_search="search term here"]

    – Any text you want that will be “searched for” within the inventory item.

  • [wpinventory inventory_status="2"]

    – Filter items by their status.  Accepts either ‘active’ or ‘inactive’ parameters.

    • Active    = 2
    • Inactive = 1
  • [wpinventory hide_low="0"]

    – This is an override setting.  If you set this to “0” then that is saying “do not” honor the hide low quantity setting in the general settings.  Which will in turn display all inventory.

  • [wpinventory hide_low_quantity="20"]

    – This is another override.  Say you have your general quantity hide low set to 30 in the system.  This example would now show any quantity that is 20 or more.

    Example of these two together:

  • [wpinventory hide_low="1" hide_low_quantity="20"]

    Note:  We set the hide_low equal to : 1 –  This means “enable hide” and has to be accompanied by the hide_low_quantity parameter.

    – The only necessary usage of this shortcode combination is if you do not have a general hide low quantity setting set, however for this particular list of items you do want to hide items of a certain quantity or lower.

  • [wpinventory inventory_year="2018"]

    – This will show inventory belonging to a specific year.

Advanced User Control

If you are a licensed user and have a valid Advanced User Control license, then you may do the following to display inventory items on the front end.  Please note that these options are only available for the Advanced User Control version 1.1.0 and up.

  • [wpinventory user_id="self-or-none"]

    – This will display all of the inventory items for the logged in user.  If logged out, it will display no inventory items at all.

  • [wpinventory user_id="self-or-all"]

    – This will display all of the inventory items for the logged in user.  If logged out, it will display all of the inventory items.

  • [wpinventory user_id="self-or-template" template="your-template-file.php"]

    – This will display all of the inventory items for the logged in user.  If logged out, it will display a custom template of information utilizing the template override system.  Simply create a .php file and put it in the “views” folder.  Then, above in the shortcode where it says “template=”, provide the file name.  For example:  file.php.  The “.php” extension isn’t necessary but can be included.  This allows for a much better user experience and allows you to give the proper directions to the user in order to view or get started to view inventory items on your site.

Advanced Inventory Manager

  • [wpinventory type_id="1,2,3"]

    – Accepts a number value for the ID of the inventory type you wish to display.  Can also be separated with a comma to add multiple inventory types.

Sorting Display

  • [wpinventory order="name DESC"]

    – This will sort the inventory on the page by the ‘name’ field and it will order it in reverse alphabetical order.  So from Z to A.  If you leave out the “DESC” then it will sort the inventory by the ‘name’ field in alphabetical order, or from A – Z.  Lastly, the “DESC” is not case sensitive.  So it could be “DesC” and still work. You can do this type of combination for virtually any field EXCEPT date fields.

Ordering by two or more fields

  • [wpinventory order="quantity DESC, number ASC"]

    – allows multiple sort parameters. This would sort first by quantity descending, then number ascending.  Try using other combinations to suit your needs.

Combining Shortcode Attributes

You can also combine shortcode attributes, like the example below. You can find more information on the Shortcode Attribute Linking page.

[wpinventory page="3" page_size="15" category_id="5,7,12"]