I am using the plugin "WP Attachments" to display attached media files on the post.
The plugin does not seem to have the ability to manually call the list in my template and I think the plugin is not really being supported anymore. I checked in the plugin code and I think the line below is the key.
add_filter('the_content', 'wpatt_content_filter');
My coding ability is limited, but I basically changed 'the_content' to 'the_attachedfiles' and in my functions.php I added:
function the_attachedfiles( $more_link_text = null, $strip_teaser = false ) {
/**
* Filters the post content.
*
* @since 0.71
*
* @param string $content Content of the current post.
*/
$content = apply_filters( 'the_attachedfiles', $content );
$content = str_replace( ']]>', ']]>', $content );
echo $content;
}
Then in my template I added the function I created as so:
<?php the_attachedfiles(); ?>
My question is, can I do this without changing plugin codes? If the plugin gets updated, I'd be forced to manually edit again. So would rather want an alternative.
Secondly, if I'm going to have to change the code in the plugin, then is this the best way and the line I added in the functions.php, I am guessing could also be better.
Any improvements would be appreciated.