Documentation

Adding custom post types

In after_setup_theme use:

// ADD REFERENCE POST TYPE
Posts::addType(array(
    "slug" => "reference",
    "name" => "Reference",
    "icon" => "dashicons-admin-comments",
));

Category and Tag taxonomies are added automatically.

To add your own taxonomy, use:

// ADD CUSTOM CATEGORY
Posts::addTaxonomy('category', 'reference', 'My Taxonomy');

Getting Posts

To get posts in your .latte template use the smplGetPosts() function:

{var $posts = smplGetPosts([
    "type" => "reference",
    "category" => "reference",
    "count" => 6,
])}
{while $reference->have_posts()}
    {php $reference->the_post()}
    {include 'content/list/reference.latte'}
{/while}

Config options:

OptionTypeDefault valueDescription
typestringpostPost type to fetch
countint-1Count of posts
categorystring/arrayarray()Filter by categories
tagstring/arrayarray()Filter by tags
taxonomystring/arrayarray()Filter by custom taxonomy
nocachebooleanfalseDisable caching results
noqueriedbooleantrueExclude already queried posts
excludearray(int)array()Exclude provided post IDs (post__not_in)
includearray(int)array()Include provided post IDs (post__in)
custom_paramsarray()array()Use custom parametters, please see official WordPress Documentation

Functions

sRender($template = null, $vars = [])
sRenderToString($template = null, $vars = [])
sInclude($dir = null, $type = null)
smplOption($key = null)
smplOptionLng($key = null)
smplMeta($key = null, $id = null)
smplMetaLng($key = null, $id = null)
smplOptionImage($option_name = null, $size = 'large')
smplOptionImageUrl($option_name = null, $size = 'large')
smplMetaImage($meta_name = null, $size = 'large', $id = null)
smplMetaImageUrl($meta_name = null, $size = 'large', $id = null)
smplImageCopyright($id = null)
smplAttachmentMeta($meta_name = null, $attachment_id = null)
smplMetaGallery($meta_name = null)
smplOptionGallery($option_name = null)
smplAttachmentImageSrc($id = null, $size = 'full')
smplOptionAttachment($key)
smplMetaAttachment($key)
smplGetPosts($options = null)
smplPostMeta($key = null, $id = null)
smplExcerpt($charlength = 120, $id = null, $echo = false, $content = null)
smplExcerptMore()
smplTermMeta($term = null, $id = null)
smplReadTime($id = null, $speed = 200)
smplDebug($data = null)
smplDebugJs($type = null, $title = null, $message = null)
smplPostTermsHierarchy($term = null)
smplPostTermsHierarchyCached($term = null)
smplAssociationItem($option = null)
smplAssociationPermalink($option = null)
smplAssociationItemWithImage($option = null)
smplEdit($key = null)
smplEditNl2Br($key = null)
smplEditAutop($key = null)
smplEditLng($key = null)
smplEditNl2BrLng($key = null)
smplEditAutopLng($key = null)
smplEditMeta($key = null)
smplEditMetaNl2Br($key = null)
smplEditMetaAutop($key = null)
hipsum($config = [])
smplAsset($url = null)
smplInlineSvg($svg = null, $class = null, $noaspect = false)
smplInlineSvgLogo($class = null, $noaspect = false)
attachment_realpath($attachment_id, $size = null)
is_admin_user()

getB64Logo($class = '', $attachment_id = null)
function getFooterSvgLogo($class = '') // => getB64Logo

Front End Editor

smplEdit($key = null)
smplEditNl2Br($key = null)
smplEditAutop($key = null)

smplEditLng($key = null)
smplEditNl2BrLng($key = null)
smplEditAutopLng($key = null)

smplEditMeta($key = null)
smplEditMetaNl2Br($key = null)
smplEditMetaAutop($key = null)

Hipsum

$default_config = [
	"type" => "hipster-centric",
	"p" => 1,
	"s" => 3,
	"ps" => 16,
	"baby" => 0,
];
hipsum($default_config)

Check if user is logged in and admin

is_admin_user()