Skip to content

Instantly share code, notes, and snippets.

Alexis J. Villegas ajvillegas

View GitHub Profile
@ajvillegas
ajvillegas / display-attachment-details.php
Created May 10, 2017
Illustrates how to display attachments using data extracted from wp_prepare_attachment_for_js().
View display-attachment-details.php
<?php
/**
* Illustrates how to display a basic list of attachments when using data extracted
* from the wp_prepare_attachment_for_js() array.
*
* @author Alexis J. Villegas <alexis@ajvillegas.com>
* @link https://developer.wordpress.org/reference/functions/wp_prepare_attachment_for_js/
*/
@ajvillegas
ajvillegas / get-attachment-details.php
Last active Aug 12, 2018
Illustrates how to extract attachment details returned by wp_prepare_attachment_for_js().
View get-attachment-details.php
<?php
/**
* Illustrates how to extract attachment details returned by wp_prepare_attachment_for_js().
*
* The wp_prepare_attachment_for_js() function returns an array with the attachment post object
* that can be used to extract specific information for the attachment.
*
* Following is a list of all the details that the function returns extrated into individual variables.
*
You can’t perform that action at this time.