As mentioned in the comments, neither single-thumbnail.php
or single-ad.php
will work in a simple manner. Sure a complex solution/workaround could be written but it’s totally unnecessary. The template hierarchy in WordPress doesn’t work that way. Whatever follows single-
in a single-XXXXX.php
file is used to denote the content type/post type. So the single-ad.php
would only be used by WordPress if it was attempting to display an ad
post type.
Instead, make a duplicate of single-ad.php
and name the copy single-attachment.php
. Then go ahead formatting it however you like.
Now to get the url for your link you want to try the following:
<?php
//First we get the ID of the Featured Image you attached to a post.
$attachID = get_post_thumbnail_id( $post->ID );
//Then we use that ID to get the permalink/url.
//Not the URL of image file itself but of the attachment post type.
$attachLink = get_permalink( $attachID, false );
?>
<!-- Finally we echo out the permalink into our HREF tag -->
<a href="<?php echo $attachLink; ?>">Link to the Attachment Post</a>
That should address everything you need.
Here are the links to the functions I used: