Johnathan Miller
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
@lgallus @boxystudio Here is what I’m doing to pull in recipe meta data.
Place this in your functions.php file
if (class_exists('Cooked_Plugin')) { add_action('rest_api_init', 'api_posts_meta_field'); function api_posts_meta_field() { register_rest_field('cp_recipe', '_meta', array( 'get_callback' => 'rest_get_post_meta', 'schema' => null )); } function rest_get_post_meta($object) { $post_id = $object['id']; $post_meta = get_post_meta($post_id); $recipe_meta = array(); if (isset($post_meta['_recipe_settings'])) { $post_meta_unserialized = unserialize($post_meta['_recipe_settings'][0]); foreach ($post_meta_unserialized as $k => $v) { if (in_array($k, array('difficulty_level', 'prep_time', 'cook_time', 'total_time', 'ingredients', 'directions', 'nutrition', 'gallery'))) { $recipe_meta[$k] = $v; } } } return $recipe_meta; } }Forum: Fixing WordPress
In reply to: User login – Unable to Authenticatebump!
Forum: Fixing WordPress
In reply to: User login – Unable to AuthenticateI turned on error reporting and this line outputs:
Fatal error: Call to undefined function add_action() in /.../wp-admin/includes/dashboard.php on line 1165…which is the
wp_dashboard_quotafunction.—MORE DETAILS—
WordPress version: 4.1.1
PHP: 5.3.28
Viewing 3 replies - 1 through 3 (of 3 total)