AHC and ESSL Wordpress Hosting Service

Post List Shortcode

Using the Post List Shortcode

This shortcode will produce a list of pages, posts or any other post type. It will also filter by category or any other custom taxonomy, and provides most of the options which are available in the get_posts WordPress function.

Shortcode options

show_excerpt
[boolean – default true] This will include the excerpt for the posts/pages in the list.
show_thumb
[boolean – default true] This will include the fewatured image (if one is set) for the posts/pages in the list.
show_posted_on
[boolean – default false] This will include the date and post author for the posts/pages in the list.
show_posted_in
[boolean – default false] This will include the categories/tags for the posts/pages in the list.
thumb_size
[string – default featured-post
This is used to set the size of the thumbnail used.
thumb_class
[string – default alignright
This will set a CSS class for the thumbnail used.
title_tag
[string – default h3
This will set the HTML tag used for the title for the posts/pages in the list.
read_more
[string – default
This will insert a link to the post/page using the text given – otherwise only the title and thumbnail (if used) will link to the post/page.
class
[string – default
This sets a CSS class on the list’s outer ul wrapper.
li_class
[string – default ‘clearfix’
This sets a CSS class on the list’s individual li elements.
include
[string – default
This should consist of a comma-separated list of page/post IDs to include in the list.
exclude
[string – default
This should consist of a comma-separated list of page/post IDs to exclude from the list.
limit
[integer – default 10
This sets the number of posts/pages which are displayed in the list.
author
[string – default
This will retrieve posts/pages which have a particular author.
category
[string – default
This is a comma-separated list of category ‘slugs’ which are used to filter the list.
order
[string – default DESC
This denotes the order in which posts/pages are displayed (ASC or DESC)
orderby
[string – default date
This denotes which field to order the posts/pages by. To list pages or other hierarchical post types in their default order, use menu_order in this parameter.
meta_key
[string – default
This is used in conjunction with the orderby parameter when the list is going to be ordered using a custom field. The name of the custom field would be set here, and orderby set to meta_value (for text based values, to sort alphabetically) or meta_value_num (for numerical values).
post_parent
[string – default false
This can be used to retrieve child pages of a given page or other hierarchical post type.
post_status
[string – default ‘publish’
This can be set to publish, pending, draft, auto-draft, future, private, inherit, trash or any.
post_type
[string – default ‘any’
This can be set to any post type supported in the theme.
tax_operator
[string – default IN
This will govern the filtering of the list by taxonomy (see below). Possible values are IN or NOT IN.
tax_term
[string – default
This would filter the list by a given term – must be used in conjunction with taxonomy.
taxonomy
[string – default
This is used to denote the taxonomy of the given term (tax_term) above.

Most of these options map directly to the WP_Query parameters which has excellent documentation in the WordPress Codex.

© Copyright Leeds 2017