/
var
/
www
/
barefootlaw.org
/
wp-content
/
themes
/
archub
/
Upload File
HOME
<?php /** * The Liquid Themes ArcHub Theme * * Note: Do not add any custom code here. Please use a child theme so that your customizations aren't lost during updates. * http://codex.wordpress.org/Child_Themes * * @link https://codex.wordpress.org/Theme_Development * @link https://codex.wordpress.org/Child_Themes * * Text Domain: archub * Domain Path: /languages/ */ // Starting The Engine / Load the Liquid Framework ---------------- include_once( get_template_directory() . '/liquid/liquid-init.php' ); add_action( 'rest_api_init', 'add_thumbnail_to_JSON' ); function add_thumbnail_to_JSON() { //Add featured image register_rest_field( 'post', // Where to add the field (Here, blog posts. Could be an array) 'featured_image_src', // Name of new field (You can call this anything) array( 'get_callback' => 'get_image_src', 'update_callback' => null, 'schema' => null, ) ); } function get_image_src( $object, $field_name, $request ) { $feat_img_array = wp_get_attachment_image_src( $object['featured_media'], // Image attachment ID 'large', // Size. Ex. "thumbnail", "large", "full", etc.. true // Whether the image should be treated as an icon. ); return $feat_img_array[0]; }