Post Meta
The aikb_render_post_meta($post_id) function is responsible for displaying the meta information for posts in your Knowledge Base (views, likes, author, date, and reading time). It is fully customizable using WordPress filters, which allows you to change visibility, labels, design, and output.
Filter: aikb_post_meta_visibility
Purpose:
Control which meta elements are displayed (views, likes, date, read time, author).
Default behavior:
$visibility = array(
'views' => true,
'likes' => true,
'date' => true,
'read' => true,
'author' => true,
);
Usage Example:
Hide views and likes:
add_filter('aikb_post_meta_visibility', function($visibility) {
$visibility['views'] = false;
$visibility['likes'] = false;
return $visibility;
});
Keys you can use:
views– Post views countlikes– Number of helpful votesdate– Published or updated dateread– Reading timeauthor– Author name
Filter: aikb_post_meta_labels
Purpose:
Change the text labels for meta elements.
Default behavior:
$labels = array(
'views' => 'views',
'likes' => 'Likes',
'post_by' => 'By',
'read' => 'min read'
);
Usage Example:
Rename “views” to “Seen” and “Likes” to “Helpful”:
add_filter('aikb_post_meta_labels', function($labels) {
$labels['views'] = 'Seen';
$labels['likes'] = 'Helpful';
return $labels;
});
Filter: aikb_post_meta_design
Purpose:
Customize the HTML wrapper class or inline styles for the meta block.
Default behavior:
$design = array(
'wrapper_class' => 'aikb-post-meta',
'wrapper_style' => '',
);
Usage Example:
Add a custom class and style:
add_filter('aikb_post_meta_design', function($design) {
$design['wrapper_class'] .= ' my-custom-class';
$design['wrapper_style'] = 'background-color:#f5f5f5; padding:10px;';
return $design;
});
Filter: aikb_post_meta_output
Purpose:
Modify the final HTML output of the meta block. You can append, prepend, or completely replace the output.
Default usage:
return apply_filters('aikb_post_meta_output', $html, $post_id, $views_count, $yes_count, $date_label, $display_date, $author_name);
Usage Example:
Add custom text at the end of meta:
add_filter('aikb_post_meta_output', function($html, $post_id, $views, $likes, $date_label, $date, $author) {
$html .= '<span class="custom-meta">Thank you for reading!</span>';
return $html;
}, 10, 7);
Was this helpful?
0 out of 0 found this helpful
Still no luck? We can help!
Get in touch with our friendly support team.
Recently Viewed Articles
- Loading recently viewed articles...