Shortcode templatation_posts details
At Templatation.com, in few of our themes we use [templatation_posts] Shortcode. In this article, I will list parameters and other info for this shortcode.
Available parameters for this Shortcode are below (with their default values):
'template' => 'templates/tt-posts-sc.php', 'id' => false, 'posts_per_page' => get_option( 'posts_per_page' ), 'post_type' => 'post', 'taxonomy' => 'category', 'tax_term' => false, 'tax_operator' => 'IN', 'author' => '', 'tag' => '', 'meta_key' => '', 'offset' => 0, 'order' => 'DESC', 'orderby' => 'date', 'post_parent' => false, 'post_status' => 'publish', 'ignore_sticky_posts' => 'no', 'temptt_show_filters' => 'no', 'temptt_filter_all' => 'yes', 'temptt_show_title' => 'yes', 'temptt_show_excerpt' => 'yes', 'temptt_show_readmore'=> 'yes',
So if you just use [templatation_posts] as shortcode, it will display Posts. However, this shortcode is very powerful and you can use it to display almost any content in the way you want.
Here is an example. Say you want to display Portfolios, then you can use.
[templatation_posts temptt_show_filters='yes' post_type='tt_portfolio' posts_per_page='30' template='templates/tt-portfolio-sc.php']
Above shortcode will grab the template file for displaying content from THEME(or Child theme) templates/tt-portfolio-sc.php file. (more on this later below).
You will also note temptt_show_filters parameter set as yes, so it will display portfolios sortable by clicking on category. As seen here https://ttplay.wpengine.com/cakeryshop/portfolio/
Now say you want to display portfolios only from certain categories. So you can use this :
[templatation_posts taxonomy='tt_portfolio_cats' temptt_show_filters='yes' post_type='tt_portfolio' posts_per_page='30' tax_term='category1,category2']
Please note the taxonomy and tax_term parameter in above shortcode. The earlier one is name of taxonomy, and latter is slug. So category1,category2 are the slug of the portfolio category that we want to include posts from.
Now lets talk a bit about template file. In few cases you may want to customise the display of the content on the front end. This is very easy as we are using template file for the output of shortcode.
So just create templates folder in your child theme, and copy templates/tt-portfolio-sc.php from parent theme into that and modify tt-portfolio-sc.php as you want.
Hope this helps, and if you have any questions feel free to contact me from https://templatation.com/support/