how do I match an image title from the media library to a variable then echo that image? this is my current code...
<?php
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => null,
);
$attachments = get_posts( $args );
if ($attachment->post_title == $programme) {
echo the_attachment_link($post->ID, false);
}
?>