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. In comma separated format. Note: If multiple post types provided, the customizer settings of the first one will be respected. Since: 1.7.55
    • 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 . Since 1.7.53
  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 . Since 1.7.69
  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. Since 1.7.69
    • Possible values: slider / archive
    • Default value: archive
  11. slider_image_ratio — When view: slider , decide which ratio the images will have. Since 1.7.69
    • Possible values: A ratio for img
    • Default value: 2/1
  12. slider_autoplay — Enable or disable slider autoplay for slider. Since 1.7.69
    • Possible values: number / no
    • Default value: no
  13. no_results — Decide how to handle the no posts state. 404 — output the regular 404 template. skip — output nothing. Since 1.8.5
    1. Possible values: 404 / skip
    2. Default value: 404

Usage example:
[blocksy_posts term_ids="10,25,48" limit="4" has_pagination="no"]
// With content before the listing, works since Blocksy 1.8.5
[blocksy_posts term_ids="10,25,48" limit="4" has_pagination="no"]<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

Not the solution you are looking for?

Please check other articles or open a support ticket.