scf-posts

Outputs posts of defined post type. Also supports categories.

Short Code

[scf-posts]

Attributes

Attribute Description Default Value
type Standard or a registered custom post type. i.e. post, page or my-post (use post slug)

Value Purpose
post Standard posts
page Standard pages
slug-of-custom-post-type Custom post type
Optional post
category Comma separated list of category names (slugs) or IDs. Do not use or mix both. Optional -
status Post status; i.e. publish, draft, trash or etc.

Value Purpose
publish Published
pending Pending review
draft Draft
auto-draft Newly created post, with no content
future Publish in future
private Not visible to users who are not logged in
trash Post in trashbin
any Any status, except those from post statuses with ‘exclude_from_search’ set to true
Optional publish
show Number of posts to fetch from database. Set to -1 to fetch all posts. Optional 3
orderby Order the posts by specified information; followings are supported:

Value Purpose
ID Post ID
title Post title
name Post slug
date Publish date
modified Modified date
menu_order Menu order
author Author
rand Random

 

Optional date
order Ascending or descending order

Value Purpose
desc Descending
asc Ascending
Optional desc
return Return output. Specify multiple items to include in the output (for a post). Items must be separated with a comma. You can arrange the comma separated items, in the desired order. This works like an inline template for a post object being output on frontend.

Valid values are:

Value Purpose
title Post title
link-title Post title as link
link Post link (see notes below)
content Post content
excerpt Post excerpt
date-publish Publish date
date-modified Modified date
author Post author
Optional link-title
output Output HTML tag, only followings are supported:

Value Purpose
li Unordered list
div HTML DIV
Optional li

Notes

The ‘return‘ parameter outputs a ‘More’ link with a permalink to post’s single page. If you want to change the label of this link, you can use ‘filter_label_more‘ filter in your theme’s functions.php file.

For example:

function change_label($label) {
   return "Read more...";
}
add_filter('filter_label_more', 'change_label');

The above code will override the default lable (‘[More]’) with your defined label (‘Read more…’).