How to Display Custom Fields in Blocksy Post Cards and Archives
Content
Many WordPress users leverage custom post types and custom fields to create unique content structures for their websites. A common challenge when using the Blocksy theme is figuring out how to display the values of these custom fields within the post cards on archive pages or in the post meta sections.
This guide explains why this happens and provides the most common solutions based on community discussions and available workarounds.
Why Custom Fields Don't Appear by Default
The Blocksy theme's customization options in the WordPress Customizer are designed to work with standard post metadata, such as the author, date, and categories. The interface for adding elements to post cards, found under options like Customizer → Post Types → [Your Post Type] → Card Options → Post Meta, is pre-configured for these common elements. Since custom fields can have any name and are created by users or plugins, the theme cannot automatically list every possible field in its options panel.
This is a design limitation of the theme's free version, and based on community threads, the Blocksy team has indicated that native support for selecting custom fields in the Card Options may be introduced as a premium feature in the future.
Common Solutions to Display Custom Fields
1. Using the blocksy:post-meta:items Filter (For Developers)
For those comfortable with code, the recommended method is to use a WordPress filter hook. The Blocksy theme provides a specific filter, blocksy:post-meta:items, which allows you to add custom items to the post meta output.
Example Code Snippet:
add_filter('blocksy:post-meta:items', function($items, $id) {
// Replace 'your_custom_field' with the name of your actual custom field
$custom_field_value = get_post_meta($id, 'your_custom_field', true);
if (!empty($custom_field_value)) {
$items[] = [
'id' => 'custom-field',
'enabled' => true,
'label' => 'Your Label: ' . $custom_field_value
];
}
return $items;
}, 10, 2);How to use this:
- Add this code to your child theme's
functions.phpfile. - Replace
your_custom_fieldwith the exact name (key) of your custom field. - Replace
Your Label:with the desired text you want to display before the value. - Once added, the new item should appear in the list of available Post Meta elements within the Blocksy Customizer for you to enable.
2. Direct Template Modification (Advanced)
Another approach is to modify the template file that renders the post cards. This is a more advanced method and should always be done within a child theme to prevent your changes from being overwritten by theme updates.
You would need to locate the appropriate template file (often in template-parts/) and use standard WordPress functions to fetch and display your custom field value where desired.
Example:
<?php echo get_post_meta(get_the_ID(), 'your_custom_field', true); ?>
The complexity here is identifying the correct file and placement without breaking the existing design. This method offers maximum flexibility but requires a higher level of technical skill.
Important Considerations
- Child Theme: Always use a child theme when adding custom code to your website. This ensures your modifications are safe during theme updates.
- Plugin Conflicts: If you are using a plugin to manage custom post types or fields, ensure it is compatible with the latest version of WordPress and Blocksy.
- Specificity: The solutions above are generally for adding fields to post meta. Displaying a custom field elsewhere in a card (e.g., in the title) would require a different approach, potentially involving more complex template edits.
While displaying custom fields in Blocksy requires a bit of custom code, the provided filter hook offers a robust and supported method for achieving this functionality. For users unable to implement code-based solutions, watching for future theme updates that may include this feature in the Customizer is advised.
Related Support Threads Support
-
Change single post element positionshttps://wordpress.org/support/topic/change-single-post-element-positions/
-
Post Animationhttps://wordpress.org/support/topic/post-animation-2/
-
Custom page templatehttps://wordpress.org/support/topic/custom-page-template-36/
-
Date and month archivehttps://wordpress.org/support/topic/date-and-month-archive/
-
Creating Category Template?https://wordpress.org/support/topic/creating-category-template/
-
Single post template from custom typehttps://wordpress.org/support/topic/single-post-template-from-custom-type/
-
Custom post type order archives pagehttps://wordpress.org/support/topic/custom-post-type-order-archives-page/
-
Is it possible to display Social share on archive page?https://wordpress.org/support/topic/is-it-possible-to-display-social-share-on-archive-page/
-
Add custom fields to card elements in Archivehttps://wordpress.org/support/topic/add-custom-fields-to-card-elements-in-archive/
-
Blog structure on different pageshttps://wordpress.org/support/topic/blog-structure-on-different-pages/
-
Custom Fields in the Custom Post Type Templatehttps://wordpress.org/support/topic/custom-fields-in-the-custom-post-type-template/
-
Add Content to Blogs Pagehttps://wordpress.org/support/topic/add-content-to-blogs-page/
-
Clickable post cardhttps://wordpress.org/support/topic/clickable-post-card/
-
Display template elements via Content Blocks – is it possible?https://wordpress.org/support/topic/display-template-elements-via-content-blocks-is-it-possible/
-
Full post contenthttps://wordpress.org/support/topic/full-post-content-2/
-
custom page in child theme blocksyhttps://wordpress.org/support/topic/custom-page-in-child-theme-blocksy/
-
How to Display Custom Post type on Homepage?https://wordpress.org/support/topic/how-to-display-custom-post-type-on-homepage/
-
Display ACF in Single Posthttps://wordpress.org/support/topic/display-acf-in-single-post/
-
Custom Page Templatehttps://wordpress.org/support/topic/custom-page-template-37/
-
Custom Taxonomy Archive Templatehttps://wordpress.org/support/topic/custom-taxonomy-archive-template/
-
How to display date as “Since [year of publication]” on a post?https://wordpress.org/support/topic/how-to-display-date-as-since-year-of-publication-on-a-post/
-
Add custom fields value in category cardshttps://wordpress.org/support/topic/add-custom-fields-value-in-category-cards/
-
Tips for using post shortcodehttps://wordpress.org/support/topic/tips-for-using-post-shortcode/
-
Comment form before comments on single posthttps://wordpress.org/support/topic/comment-form-before-comments-on-single-post/
-
Archive view customization for custom post typehttps://wordpress.org/support/topic/archive-view-customization-for-custom-post-type/
-
Re-use “Card Options” ?https://wordpress.org/support/topic/re-use-card-options/
-
Archive Template Hierarchyhttps://wordpress.org/support/topic/archive-template-hierarchy/
-
Post format and text effect templatehttps://wordpress.org/support/topic/post-format-and-text-effect-template/
-
Adding Custom Fields to Post Meta in Card Elementshttps://wordpress.org/support/topic/adding-custom-fields-to-post-meta-in-card-elements/
-
[blocksy_posts post_type=”post” limit=”1″]https://wordpress.org/support/topic/blocksy_posts-post_typepost-limit1/
-
How do I add a custom field to the child theme post template?https://wordpress.org/support/topic/how-do-i-add-a-custom-field-to-the-child-theme-post-template/
-
Custom Post Type stopped workinghttps://wordpress.org/support/topic/custom-post-type-stopped-working/