Documentation

Everything you need to get started with Blocksy Theme and Companion

[blocksy_posts] shortcode

Starting with Blocksy Companion 1.7.49 there is the blocksy posts shortcode made available for usage. This shortcode is very useful in combination with Gutenberg or with other page builders, when you want to quickly display a list of posts on custom pages or other dynamic locations. Most important features of it:

  • Easy to use
  • Uses Blocksy’s archive templates so the same styles apply
  • Custom post type support
  • Inherits Customizer settings for the picked custom post type
Available arguments:
  1. post_type – needed post type (comma separated format if more than one post type).
    Note: If multiple post types provided, the customizer settings of the first one will be respected.
    • Example: book,movie,song
    • Default value: post
  2. limit – Amount of posts to display per page.
    • Default value: 5
  3. orderby – Sorting logic.
    • Possible values: post_date, comment_count, rand. Everything accepted in WP_Query orderby
    • Default value: post_date
  4. order – Sorting order.
    • Possible values: DESC, ASC Everything accepted in WP_Query order
    • Default value: DESC.
  5. term_ids – ID of the terms to display posts from. In comma separated format, different taxonomies can be mixed.
    • Example: 23,15,38
    • Default value: null
  6. exclude_term_ids — ID of the terms to exclude the posts from. Same format as term_ids.
  7. post_ids – Specific IDs of the posts to display. In comma separated format
    • Example: 12,13,18
    • Default value: null
  8. has_pagination – Display or hide the pagination
    • Possible values: yes, no
    • Default value: yes
  9. ignore_sticky_posts – Ignore or display the sticky posts
    • Possible values: yes, no
    • Default value: no
  10. view – Display shortcode as a slider or as an archive.
    • Possible values: slider/archive
    • Default value: archive
  11. slider_image_ratio – When view: slider, decide which ratio the images will have.
    • Possible values: 1/1, 2/1, 16/9, 4/3, 1/2, 9/16, 3/4
    • Default value: 2/1
  12. slider_autoplay – Enable or disable slider autoplay for slider.
    • Possible values: number/no
    • Default value: no
  13. no_results – Decide how to handle the no posts state.
    • Possible values: 404/skip
      • 404 – output the regular 404 template
      • skip – output nothing.
    • Default value: 404
  14. filtering – Enables the filter options from the Post Types Extra extension
    • Possible values: yes/no
      • yes – displays the filters
      • no – hides the filters
    • Default value: no.
  15. class – Add a custom class to the main container wrapper.
Usage examples:
[blocksy_posts limit="4"]
Posts from certain categories
[blocksy_posts term_ids="10,25,48"]
Different custom post type
[blocksy_posts post_type="portfolio"]
Posts without pagination
[blocksy_posts post_type="movies" limit="8" has_pagination="no"]
With content before the listing
[blocksy_posts]<h3>My posts</h3>[/blocksy_posts]
Change WP_Query args for all shortcodes at once

Name: blocksy:general:shortcodes:blocksy-posts:args
Type: Filter
Arguments: 1
Description: Change WP_Query arguments for blocksy_posts shortcode. Since 1.8.4
Possible values: none/left/right

Important Notice!

The blocksy_posts slider shortcode does not display its styling out of the box, if WooCommerce isn’t loaded. This is due to performance reasons. It can easily be enabled back, without installing WooCommerce by integrating the following snippet inside of the functions.php file of your Child theme.

Not the solution you are looking for?

Please check other articles or open a support ticket.