Overview
The ctaol_item_html filter hook allows you to modify the HTML content of items in the grid. This filter can be combined with the ctaol_get_post_data filter hook to add extra data to the items grid.
Hook Parameters
- $content: The original HTML content of the item.
- $module_props: An array containing module-specific properties.
- $sections: An array containing HTML sections for different parts of the item.
- $post_data: An array containing post data associated with the item
function ctaol_item_html_filter( $content, $module_props, $sections, $post_data ) { // Use the admin label if you need to apply the filter only to a specific module $custom_content = ''; if ( isset( $module_props['admin_label'] ) && $module_props['admin_label'] === 'request_extra_data' && ! empty( $post_data['custom_data'] ) ) { $custom_content = sprintf( '<div class="ctaol-extra-data-container"><strong>ACF Text: </strong>%1$s</div>', $post_data['custom_data'] ); } return $sections['image'] . $sections['title'] . $custom_content . $sections['excerpt'] . $sections['link']; } add_filter( 'ctaol_item_html', 'ctaol_item_html_filter', 10, 4 );
0 Comments