The main requirement of this plugin was to attach files to posts and let users download them from the post page. So far, we have created the background to save and display the attachments. Now, it's time to implement the main requirements by displaying them after the content of each post.
At the start of this chapter, we created a plugin to use the the_content filter and add dynamic content after the post. The same technique will be used in this scenario. Let's consider the following code for the implementation of the the_content filter:
add_filter( 'the_content', 'wpqpa_file_attachment_display' );function wpqpa_file_attachment_display( $content ){ global $post; if( is_singular( 'post' ) ){ return $content ...