import React, { Fragment, useState } from 'react'; import { Element, Link } from 'react-scroll'; import CopyToClipboard from 'react-copy-to-clipboard'; import Header from '../../general/Header'; import Footer from '../../general/Footer'; import Loader from 'Shared/Loader'; import { __wprm } from 'Shared/Translations'; import Api from 'Shared/Api'; import Icon from 'Shared/Icon'; import FieldGroup from '../../fields/FieldGroup'; import RecipeImport from './RecipeImport'; import RecipeMedia from './RecipeMedia'; import RecipePostType from './RecipePostType'; import RecipeGeneral from './RecipeGeneral'; import RecipeTimes from './RecipeTimes'; import RecipeCategories from './RecipeCategories'; import RecipeIngredients from './RecipeIngredients'; import RecipeEquipment from './RecipeEquipment'; import RecipeInstructions from './RecipeInstructions'; import RecipeNutrition from './RecipeNutrition'; import RecipeCustomFields from './RecipeCustomFields'; import RecipeNotes from './RecipeNotes'; const EditRecipe = (props) => { const hasUpload = props.recipe.video_id > 0; const hasEmbed = ! hasUpload && ( -1 == props.recipe.video_id || props.recipe.video_embed ); const hasVideo = hasUpload || hasEmbed; const [nutritionWarning, setNutritionWarning] = useState(false); let structure = [ { id: 'import', name: __wprm( 'Import' ), elem: ( ) }, { id: 'media', name: __wprm( 'Media' ), elem: ( ) } ]; if ( 'public' === wprm_admin.settings.post_type_structure || 'manual' === wprm_admin.settings.recipe_use_author ) { structure.push({ id: 'postType', name: __wprm( 'Post Type' ), elem: ( ) }); } structure.push({ id: 'general', name: __wprm( 'General' ), elem: ( ) }); structure.push({ id: 'times', name: __wprm( 'Times' ), elem: ( ) }); structure.push({ id: 'categories', name: __wprm( 'Categories' ), elem: ( ) }); structure.push({ id: 'equipment', name: __wprm( 'Equipment' ), elem: ( ) }); structure.push({ id: 'ingredients', name: 'howto' === props.recipe.type ? __wprm( 'Materials' ) : __wprm( 'Ingredients' ), elem: ( ) }); structure.push({ id: 'instructions', name: __wprm( 'Instructions' ), elem: ( ) }); // Only show nutrition for food recipes. if ( 'howto' !== props.recipe.type ) { let nutritionName = __wprm( 'Nutrition' ); let nutritionClassName = 'wprm-admin-modal-recipe-quicklink'; if ( nutritionWarning ) { nutritionClassName += ' wprm-admin-modal-recipe-quicklink-warning'; nutritionName = ( { __wprm( 'Nutrition' ) } ); } structure.push({ id: 'nutrition', name: nutritionName, className: nutritionClassName, elem: ( ) }); } // Only show custom fields when available and at least 1 is set. if ( wprm_admin_modal.custom_fields && wprm_admin_modal.custom_fields.fields && 0 < Object.keys( wprm_admin_modal.custom_fields.fields ).length ) { structure.push({ id: 'custom-fields', name: __wprm( 'Custom Fields' ), elem: ( { let newFields = Object.assign({}, JSON.parse( JSON.stringify( props.recipe.custom_fields ) ) ); newFields[ field ] = value; props.onRecipeChange({ custom_fields: newFields, }); }} /> ) }); } structure.push({ id: 'notes', name: __wprm( 'Notes' ), elem: ( ) }); return (
{ props.loadingRecipe ? __wprm( 'Loading Recipe...' ) : { props.recipe.id ? `${ __wprm( 'Editing Recipe' ) } #${props.recipe.id}${props.recipe.name ? ` - ${props.recipe.name}` : ''}` : `${ __wprm( 'Creating new Recipe' ) }${props.recipe.name ? ` - ${props.recipe.name}` : ''}` } }
{ structure.map((group, index) => ( { group.name } )) }
{ props.loadingRecipe ? :
{ structure.map((group, index) => ( { group.elem } )) }
}
{ 'waiting' === props.saveResult ? :
{ 'failed' === props.saveResult && { if ( result ) { alert( __wprm( 'The recipe has been copied and can be used in the "Import from JSON" feature.' ) ); } else { alert( __wprm( 'Something went wrong. Please contact support.' ) ); } }} > { e.preventDefault(); } }> { __wprm( 'Something went wrong during saving.' ) } { __wprm( 'Click to copy the recipe to your clipboard.' ) } } { 'ok' === props.saveResult ? { __wprm( 'Saved successfully' ) } : null }
}
); } export default EditRecipe;const conversionEndpoint = wprmp_admin.endpoints.unit_conversion; import ApiWrapper from 'Shared/ApiWrapper'; export default { get( ingredients, system = 'default' ) { const data = { ingredients, system, }; return ApiWrapper.call( `${conversionEndpoint}`, 'POST', data ); }, };
/** * WordPress dependencies */ import { Path, SVG } from '@wordpress/components'; export default ( ); jQuery(function(e){if("undefined"==typeof wc_orders_params)return!1;var t=function(){e(document).on("click",".post-type-shop_order .wp-list-table tbody td, .woocommerce_page_wc-orders .wp-list-table.orders tbody td",this.onRowClick).on("click",".order-preview:not(.disabled)",this.onPreview)};t.prototype.onRowClick=function(t){if(e(t.target).filter("a, a *, .no-link, .no-link *, button, button *").length)return!0;if(window.getSelection&&window.getSelection().toString().length)return!0;var r=e(this).closest("tr").find("a.order-view").attr("href");r&&r.length&&(t.preventDefault(),t.metaKey||t.ctrlKey?window.open(r,"_blank"):window.location=r)},t.prototype.onPreview=function(){var t=e(this),r=t.data("orderId");return t.data("order-data")?e(this).WCBackboneModal({template:"wc-modal-view-order",variable:t.data("orderData")}):(t.addClass("disabled"),e.ajax({url:wc_orders_params.ajax_url,data:{order_id:r,action:"woocommerce_get_order_details",security:wc_orders_params.preview_nonce},type:"GET",success:function(r){e(".order-preview").removeClass("disabled"),r.success&&(t.data("orderData",r.data),e(this).WCBackboneModal({template:"wc-modal-view-order",variable:r.data}))}})),!1},new t});

WP Recipe Maker Plugin Preview

Hi there!

Welcome to a live preview of the WP Recipe Maker plugin! We created an example recipe for you and added it to a regular WordPress post. This can give you an idea of how the plugin works and what it looks like.

Things you can check out in this preview:


If you want to learn even more, check out our demo site or WP Recipe Maker homepage. But our best recommendation is to just install WP Recipe Maker on your site and play around with it. There is a ton to discover!

Thumbnails

Wordpress contains 4 default thumbnails that many themes and plugins rely on. We recommend setting these sizes to match the Feast Modern Thumbnails (opens in new window) - this reduces the number of images that get generated, which consumes fewer image optimization credits in Shortpixel (+Imagify).

Clicking these settings automatically updates the database settings and can be verified in Settings > Media. medium_large is hidden from users.

  • Set thumbnail_size=180x180
  • Set medium_image_size=360x0
  • Set large_image_size=720x0
  • Set medium_large_image_size=1200x0
  • Note: The "large" is set to match the 720px content width, because the "large" image size is what Wordpress defaults to when inserting new images in the block editor. While "medium_large" sounds like it should be smaller, there's no actual rule that requires this. It doesn't follow standard conventions, but it works in our setup. Setting medium_large to 1200x0 when uploading 1200px width images essentially disables this from being used on most modern images.

    Miscellaneous

  • Set show_avatars=0 (disable Gravatar)
  • Gravatar is used for the user profile widget and comment avatars, but it loads images from a third-party site, and slows down pagespeed. We recommend not displaying avatars in the comments, and using a "Custom HTML" user profile widget for the sidebar (opens in new window).