snippet

  • Attachment Image Snippet

    This snippet for wp_get_attachment_image_src frequently appears in my theme development to select an image by its unique ID in the WordPress media library. Handy for instances where logos, banners, or any other image frequently recurs on a website and you’d rather store that image in the media library where it can be replaced or modified […]

  • Creating a custom attachment loop for images and other files in WordPress

    Creating a custom attachment loop for images and other files in WordPress

    While building an attachment.php template for a project I opted to customize the loop to properly display an image within a figure tag and the caption within figcaption to aid accessibility. Additionally if the file is not an image it will provide a button that can be styled along with a mime type. The following […]