I’m using a function to display all files attached to a post and listing them as links. The result is something like this:
echo '<a href="' . wp_get_attachment_url($attachmentImage->ID) .
'" class="dir-attachment" />' . wp_get_attachment_url($attachmentImage->ID) . '</a>';
As expected, this display a hyperlinked version of the hyperlink, but I’d like to clean it up. Is there some way to strip the http://mydomain/wp-content/uploads from the second instance display the file name only, rather than the full path?
Try this: