Insert a series of images and descriptions using the portfolio shortcode.
[hr]
[portfolio post_type=»page» post_parent=»1002″ content_width=»649″ image_ratio=»3:2″ columns=»4″ paging=false posts_per_page=»4″ orderby=»rand» order=»ASC»]
Portfolio from Categories
[code][portfolio category=»7,8,9″ columns=»4″ content_width=»926″ image_ratio=»4:3″][/code]
Parameters
- category
- (string) The category ID’s to pull portfolio items from. Can be entered as a comma separated list.
- columns
- (integer) (Optional) The number of columns to create. Default: 3
- content_width
- (integer) (Required) The area available for portfolio columns to display. This is determined by the layout being used and must be entered.
- [clear]
Standard column widths:- Full width: 880
- Half width: 420
- One third width: 267
- Two thirds width: 573
- One fourth width: 190
- Three fourth width: 649
- [clear]
- image_ratio
- (string) (Optional) The image ratio for image size. The image width is determined by the number of columns divided by the content area width. Image height is produced as a result of the image ratio. Default ratio is «3:2» (w:h).
- Any ratio can be used.
[clear]
Common ratios:- 1:1
- 2:1
- 3:2
- 4:3
- 16:9
- Any ratio can be used.
- link
- (string) (Optional) Image links to the post/page or lightbox full size image. Values «post», «lightbox». (Default: lightbox)
- title
- (string) (Optional) Include the title for the item. «Yes» to include title. Exclude field for no title.
- excerpt
- (string) (Optional) Include the excerpt for each item. «Yes» to include excerpt. Exclude field for no excerpt.
- excerpt_length
- (integer) (Optional) The length of the excerpt, number of words to display.
- posts_per_page
- (integer) (Optional) The number of items to display on each page.
- order
- (string) (Optional) Designates the ascending or descending order of the “orderby” parameter. Values: ASC, DESC (default)
- orderby
- (string) (Optional) Sort posts by. (see details at end of page)
- paging
- (bool) (Optional) Enable paging. (true/false)
- margin
- (int) (Optional) An optional value for the horizontal margin between portfolio items.
[clear]
[clear]
Examples
Portfolio items from categories with paging and excerpt:
[portfolio category="7,8,9" excerpt="yes" paging="true"]
[hr]
Portfolio Items from Pages
Portfolio items may also be generated from pages using a list of page ID’s or the child pages from a parent page ID.
Page Parameters
- post_type
- (string) (Required) Directs the query to use pages instead of posts. Must include the value «page».
- page_id
- (string) The page ID’s to include. Can be entered as a comma separated list.
- post_parent
- (integer) (Optional) Show child pages of the selected parent. Similar to using a category for posts.
[clear]
[clear]
Examples
[portfolio post_type="page" page_id="10,11,12"]
[portfolio post_type="page" post_parent="9"]
[hr]
[clear]
Order and Orderby Parameters
- order
- (string) (Optional) Designates the ascending or descending order of the «orderby» parameter.
- «ASC» — ascending order from lowest to highest values (1, 2, 3; a, b, c).
- «DESC» — descending order from highest to lowest values (3, 2, 1; c, b, a).
- orderby
- (string) (Optional) Sort posts by.
- ‘none’ — No order.
- ‘id’ — Order by post id.
- ‘author’ — Order by author.
- ‘title’ — Order by title.
- ‘date’ — Order by date. (default)
- ‘modified’ — Order by last modified date.
- ‘parent’ — Order by post/page parent id.
- ‘rand’ — Random order.
- ‘comment_count’ — Order by number of comments
- ‘menu_order’ — Order by Page Order.
[clear]
Examples
Display random posts:
[portfolio category="8" orderby="rand"]
Display popular posts:
[portfolio category="8" orderby="comment_count"]
[hr]
Advanced Parameters
For advanced usage, you can add most parameters accepted by WP_Query . The shortcode can use any of these parameters which are string or an integer values. Arrays are not supported.
Example use of WP_Query s
parameter used to return a query filtered by a search term.
- s
- (string) (Optional) Search string for filtering upon a given term.
- cat
- (string) (Optional) Include or exclude categories. Prefix with a ‘-‘ (minus) sign to exclude.
- author
- (int) (Optional) Results by author id.
- Many, many more…
- See all WP_Query parameters.
[clear]
Display posts based on search results:
[portfolio category="8" s="Lorem Ipsum"]
[clear]
Display all posts except those from a category by prefixing its id with a ‘-‘ (minus) sign:
[portfolio cat="-8"]
[clear]
[message_box type=»info» icon=»yes»]When you create video portfolio items you can specify the video size in the URL. For example, if adding the video: http://www.youtube.com/watch?v=B7UmUX68KtE&hd=1 you could specify the width and height by entering http://www.youtube.com/watch?v=B7UmUX68KtE&hd=1&width=1280&height=720 [/message_box]