Changeset 2273372
- Timestamp:
- 04/01/2020 09:04:40 PM (4 years ago)
- Location:
- wp-custom-rest-api-generator/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
wp-custom-rest-api-generator/trunk/admin/wpcrag_settings_api_function.php
r1997824 r2273372 12 12 $user_info = get_user_meta(get_the_author_meta('ID')); 13 13 14 $author_meta = (object) ['author_name' => implode($user_info[ nickname]),15 16 'author_description' => implode($user_info[ description]),17 18 'author_user_level' => (int) implode($user_info[ wp_user_level]),14 $author_meta = (object) ['author_name' => implode($user_info[]), 15 16 'author_description' => implode($user_info[]), 17 18 'author_user_level' => (int) implode($user_info[]), 19 19 20 20 'author_avatar' => get_avatar_url(get_the_author_meta('ID')), … … 30 30 function wpcrag_get_featured_image() 31 31 { 32 32 33 33 34 $featured_image = (object) ['size_thumbnail' => get_the_post_thumbnail_url($post->ID, 'thumbnail'), … … 41 42 ]; 42 43 43 return $featured_image ;44 return $featured_image; 44 45 45 46 } … … 116 117 117 118 $custom_field_keys = get_post_custom_keys($post_id); 118 119 foreach ($custom_field_keys as $key => $field_name) { 120 121 $valuet = trim($field_name); 122 123 if ('_' == $valuet{0}) { 124 125 continue; 119 120 if ($custom_field_keys) { 121 foreach ($custom_field_keys as $key => $field_name) { 122 123 $valuet = trim($field_name); 124 125 if ('_' == $valuet[0]) { 126 127 continue; 128 129 } 130 131 // matches value in the db, if found then registers to Rest API 132 133 $post_field_key = $post_type . '_' . $field_name; 134 135 if (is_array($options) && array_key_exists($post_field_key, $options)) { 136 137 register_rest_field($post_type, 138 139 $field_name, 140 141 array( 142 143 'get_callback' => 'wpcrag_get_post_meta', 144 145 'update_callback' => null, 146 147 'schema' => null, 148 149 ) 150 151 ); 152 153 } 126 154 127 155 } 128 129 // matches value in the db, if found then registers to Rest API130 131 $post_field_key = $post_type . '_' . $field_name;132 133 if (is_array($options) && array_key_exists($post_field_key, $options)) {134 135 register_rest_field($post_type,136 137 $field_name,138 139 array(140 141 'get_callback' => 'wpcrag_get_post_meta',142 143 'update_callback' => null,144 145 'schema' => null,146 147 )148 149 );150 151 }152 153 156 } 154 157 -
wp-custom-rest-api-generator/trunk/admin/wpcrag_settings_callback.php
r1997824 r2273372 122 122 $valuet = trim($value); 123 123 124 if ('_' == $valuet {0}) {124 if ('_' == $valuet) { 125 125 126 126 continue; -
wp-custom-rest-api-generator/trunk/readme.txt
r2193542 r2273372 4 4 Tags: rest api, rest, api, wp api, admin, json, custom fields, taxonomy 5 5 Requires at least: 5.0 6 Tested up to: 5. 37 Stable tag: 1.0. 26 Tested up to: 5. 7 Stable tag: 1.0. 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 45 45 == Changelog == 46 46 47 48 49 47 50 = 1.0.2 = 48 51 * Tested with the latest build 49 52 50 53 = 1.0.1 = 51 * updated meta information54 * pdated meta information 52 55 53 56 = 1.0.0 = -
wp-custom-rest-api-generator/trunk/wp_custom_rest_api_generator.php
r2193542 r2273372 9 9 Description: Admin panel for enabling Author Meta, Featured Image, Custom Fields and Taxonomies for all available Post Types in WordPress Rest API 10 10 11 Version: 1.0. 211 Version: 1.0. 12 12 13 13 Author: Centangle Interactive … … 25 25 the Free Software Foundation, either version 2 of the License, or 26 26 any later version. 27 27 28 28 WP Custom REST API Generator is distributed in the hope that it will be useful, 29 29 but WITHOUT ANY WARRANTY; without even the implied warranty of 30 30 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 31 31 GNU General Public License for more details. 32 32 33 33 You should have received a copy of the GNU General Public License 34 along with WP Custom REST API Generator. If not, see License URI: 34 along with WP Custom REST API Generator. If not, see License URI: 35 35 https://www.gnu.org/licenses/gpl-2.0.html 36 36
Note: See TracChangeset
for help on using the changeset viewer.