Displaying uploaded files in products

In the last section, we displayed the list of files in the product edit screen and updated it each time we uploaded a new file using AJAX. Now, we need to complete the implementation by displaying the files list in the frontend product page as a new tab. We already used a common function to generate the list of files for a product, and hence it's just a matter of using it within a product page tab. Let's use the following code to display the file list:

add_filter( 'woocommerce_product_tabs', 'wqwpf_product_files_tab' );function wqwpf_product_files_tab( $tabs ) {  $tabs['wqwpf_tab'] = array(    'title' => __( 'Product Files', 'wqwpf' ),    'priority' => 50,    'callback' => 'wqwpf_product_files_tab_content' );

Get WordPress Development Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.