Version Description
Download this release
Release Info
Developer | msicknick |
Plugin | Recipe Blocks |
Version | 1.1.0 |
Comparing to | |
See all releases |
Version 1.1.0
- README.txt +32 -0
- block.js +1 -0
- editor.css +1 -0
- index.php +89 -0
- style.css +1 -0
README.txt
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Recipe Blocks ===
|
2 |
+
Contributors: msicknick
|
3 |
+
Tags: recipe, gutenberg, block, ingredents, details, instructions
|
4 |
+
Donate link: https://paypal.me/MSicknick
|
5 |
+
Requires at least: 5.0
|
6 |
+
Tested up to: 5.0.1
|
7 |
+
Stable: trunk
|
8 |
+
Requires PHP: 5.6
|
9 |
+
License: GPLv3
|
10 |
+
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
11 |
+
|
12 |
+
|
13 |
+
Easy to use blocks for posting recipes that include Details, Ingredients, Directions, and Source URL.
|
14 |
+
|
15 |
+
== Description ==
|
16 |
+
The plugin adds Details, Ingredients, Directions, and Source URL blocks for posting recipes.
|
17 |
+
|
18 |
+
== Installation ==
|
19 |
+
Upload the Recipe Blocks to your WordPress blog and activate it.
|
20 |
+
Go to 'Add New' under Posts in the Dashboard.
|
21 |
+
Click on (+) 'Add block'
|
22 |
+
In the list of categories, you will now see 'Recipe Blocks'
|
23 |
+
Choose a block and begin tying.
|
24 |
+
|
25 |
+
== Changelog ==
|
26 |
+
|
27 |
+
= Version 1.1.0 (01/21/2019) =
|
28 |
+
* Made 'Ingredients' and 'Directions' titles editable
|
29 |
+
* Added a 'target = "_blank"' to source links
|
30 |
+
|
31 |
+
= Version 1.0.0 (01/21/2019) =
|
32 |
+
* Initial release
|
block.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
!function(e,t,i,a,s,l){var c=a.createElement,r=t.RichText,o=t.PlainText;e.registerBlockType("recipe-blocks/details",{title:i.__("Details","recipe-blocks"),icon:{background:"#51A0D5",foreground:"#333",src:"tag"},category:"recipe-blocks",attributes:{yields:{type:"array",source:"children",selector:".yields .recipe-detail-item-value"},preptime:{type:"array",source:"children",selector:".preptime .recipe-detail-item-value"},cooktime:{type:"array",source:"children",selector:".cooktime .recipe-detail-item-value"},totaltime:{type:"array",source:"children",selector:".totaltime .recipe-detail-item-value"}},edit:function(t){var e=t.attributes;return console.log(e),c("div",{className:t.className},c("div",{className:"recipe-detail-container"},c("div",{className:"recipe-detail-item yields"},c("span",{className:"recipe-detail-item-label"},i.__("Yields:","recipe-blocks")),c(r,{tagName:"div",placeholder:i.__("1-2 servings","recipe-blocks"),value:e.yields,onChange:function(e){t.setAttributes({yields:e})},className:"recipe-detail-item-value"})),c("div",{className:"recipe-detail-item preptime"},c("span",{className:"recipe-detail-item-label"},i.__("Prep time:","recipe-blocks")),c(r,{tagName:"div",placeholder:i.__("15 minutes","recipe-blocks"),value:e.preptime,onChange:function(e){t.setAttributes({preptime:e})},className:"recipe-detail-item-value"})),c("div",{className:"recipe-detail-item cooktime"},c("span",{className:"recipe-detail-item-label"},i.__("Cook time:","recipe-blocks")),c(r,{tagName:"div",placeholder:i.__("50 minutes","recipe-blocks"),value:e.cooktime,onChange:function(e){t.setAttributes({cooktime:e})},className:"recipe-detail-item-value"})),c("div",{className:"recipe-detail-item totaltime"},c("span",{className:"recipe-detail-item-label"},i.__("Total time:","recipe-blocks")),c(r,{tagName:"div",placeholder:i.__("1 hour 5 minutes","recipe-blocks"),value:e.totaltime,onChange:function(e){t.setAttributes({totaltime:e})},className:"recipe-detail-item-value"}))))},save:function(e){var t=e.attributes;return c("div",{className:e.className},c("div",{className:"recipe-detail-container"},c("div",{className:"recipe-detail-item yields"},c("span",{className:"recipe-detail-item-label"},i.__("Yields:","recipe-blocks")),c(r.Content,{tagName:"div",className:"recipe-detail-item-value",value:t.yields})),c("div",{className:"recipe-detail-item preptime"},c("span",{className:"recipe-detail-item-label"},i.__("Prep time:","recipe-blocks")),c(r.Content,{tagName:"div",className:"recipe-detail-item-value",value:t.preptime})),c("div",{className:"recipe-detail-item cooktime"},c("span",{className:"recipe-detail-item-label"},i.__("Cook time:","recipe-blocks")),c(r.Content,{tagName:"div",className:"recipe-detail-item-value",value:t.cooktime})),c("div",{className:"recipe-detail-item totaltime"},c("span",{className:"recipe-detail-item-label"},i.__("Total time:","recipe-blocks")),c(r.Content,{tagName:"div",className:"recipe-detail-item-value",value:t.totaltime}))))}}),e.registerBlockType("recipe-blocks/ingredients",{title:i.__("Ingredients","recipe-blocks"),icon:{background:"#51A0D5",foreground:"#333",src:"carrot"},category:"recipe-blocks",attributes:{title:{type:"array",source:"children",selector:".ingredients-title",default:i.__("Ingredients","recipe-blocks")},ingredients:{type:"array",source:"children",selector:".ingredients-list"}},edit:function(t){var e=t.attributes;return c("div",{className:t.className},c(r,{tagName:"h4",value:e.title,onChange:function(e){t.setAttributes({title:e})},className:"ingredients-title"}),c(r,{tagName:"ul",multiline:"li",placeholder:i.__("Write a list of ingredients…","recipe-blocks"),value:e.ingredients,onChange:function(e){t.setAttributes({ingredients:e})},className:"ingredients-list"}))},save:function(e){var t=e.attributes;return c("div",{className:e.className},c(r.Content,{tagName:"h4",className:"ingredients-title",value:t.title}),c(r.Content,{tagName:"ul",className:"ingredients-list",value:t.ingredients}))}}),e.registerBlockType("recipe-blocks/directions",{title:i.__("Directions","recipe-blocks"),icon:{background:"#51A0D5",foreground:"#333",src:"editor-ol"},category:"recipe-blocks",attributes:{title:{type:"array",source:"children",selector:".directions-title",default:i.__("Directions","recipe-blocks")},directions:{type:"array",source:"children",selector:".directions-list"}},edit:function(t){var e=t.attributes;return c("div",{className:t.className},c(r,{tagName:"h4",value:e.title,onChange:function(e){t.setAttributes({title:e})},className:"directions-title"}),c(r,{tagName:"ul",multiline:"li",placeholder:i.__("Write a list of directions…","recipe-blocks"),value:e.directions,onChange:function(e){t.setAttributes({directions:e})},className:"directions-list"}))},save:function(e){var t=e.attributes;return c("div",{className:e.className},c(r.Content,{tagName:"h4",className:"directions-title",value:t.title}),c(r.Content,{tagName:"ul",className:"directions-list",value:t.directions}))}}),e.registerBlockType("recipe-blocks/source",{title:i.__("Source","recipe-blocks"),icon:{background:"#51A0D5",foreground:"#333",src:"admin-links"},category:"recipe-blocks",attributes:{sourcename:{type:"string"},sourceurl:{type:"string"}},edit:function(t){var e=t.attributes;return c("div",{className:t.className},c("p",{},i.__("Source name:","recipe-blocks")),c(o,{tagName:"div",placeholder:i.__("","recipe-blocks"),value:e.sourcename,onChange:function(e){t.setAttributes({sourcename:e})},className:"sourcename"}),c("p",{},i.__("Source URL:","recipe-blocks")),c(o,{tagName:"div",placeholder:i.__("","recipe-blocks"),value:e.sourceurl,onChange:function(e){t.setAttributes({sourceurl:e})},className:"sourceurl"}),c("div",{className:"source-info"},c("div",{},i.__("Will display as: ","recipe-blocks")),c("strong",{},i.__("Source: ","recipe-blocks")),c("span",{className:"linklike"},i.__("Source name ","recipe-blocks"))))},save:function(e){var t=e.attributes;return c("div",{className:e.className},c("strong",{},i.__("Source: ","recipe-blocks")),c(r.Content,{tagName:"a",className:"source",target:"_blank",value:t.sourcename,href:t.sourceurl}))}})}(window.wp.blocks,window.wp.editor,window.wp.i18n,window.wp.element,window.wp.components,window._);
|
editor.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.wp-block-recipe-blocks-ingredients:after{content:"";clear:both;display:table}.wp-block-recipe-blocks-directions h4,.wp-block-recipe-blocks-ingredients h4{margin-bottom:20px;font-size:1.5em}.wp-block-recipe-blocks-details .recipe-detail-container .recipe-detail-item{display:table-cell;width:25%;text-align:center;border:1px solid #aaa;padding:15px 2px}.wp-block-recipe-blocks-details .recipe-detail-container .recipe-detail-item .recipe-detail-item-label{font-weight:700;font-size:16px;font-family:'Noto Serif'}.wp-block-recipe-blocks-details .recipe-detail-container .recipe-detail-item .recipe-detail-item-value{font-size:16px;font-family:'Noto Serif';padding:0}.wp-block-recipe-blocks-source{text-align:left;font-style:normal;padding:15px 25px;border-radius:10px;background-color:#f5f5f5}.wp-block-recipe-blocks-source p{margin:5px 0;font-weight:700}.wp-block-recipe-blocks-source .editor-plain-text{border-bottom:1px solid #ccc;border-radius:0;font-style:italic;padding-left:10px;background-color:inherit;color:#666}.wp-block-recipe-blocks-source .source-info{padding-top:20px;text-align:right;font-size:14px;font-weight:400;font-style:italic}.wp-block-recipe-blocks-source .source-info .linklike{text-decoration:underline;color:#0073aa}.wp-block-recipe-blocks-source .source-info .linklike:hover{color:#00a0d2}
|
index.php
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* Plugin Name: Recipe Blocks
|
5 |
+
* Description: Easy to use blocks for posting recipes that include Details, Ingredients, Directions, and Source URL.
|
6 |
+
* Version: 1.1.0
|
7 |
+
* Author: Magda Sicknick
|
8 |
+
* Author URI: https://www.msicknick.com/
|
9 |
+
* License: GPLv3
|
10 |
+
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
11 |
+
* Text Domain: recipe-blocks
|
12 |
+
*/
|
13 |
+
|
14 |
+
|
15 |
+
// Exit if accessed directly.
|
16 |
+
if (!defined('ABSPATH')) {
|
17 |
+
exit;
|
18 |
+
}
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Registers all block assets
|
22 |
+
*
|
23 |
+
*/
|
24 |
+
function register_recipe_blocks() {
|
25 |
+
|
26 |
+
if (!function_exists('register_block_type')) {
|
27 |
+
// Gutenberg is not active.
|
28 |
+
return;
|
29 |
+
}
|
30 |
+
|
31 |
+
wp_register_script(
|
32 |
+
'recipe-blocks', plugins_url('block.js', __FILE__), array('wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor', 'underscore'), filemtime(plugin_dir_path(__FILE__) . 'block.js')
|
33 |
+
);
|
34 |
+
|
35 |
+
wp_enqueue_style(
|
36 |
+
'recipe-blocks-google-fonts', '//fonts.googleapis.com/css?family=Alegreya+Sans+SC:300,400', array()
|
37 |
+
);
|
38 |
+
|
39 |
+
wp_register_style(
|
40 |
+
'recipe-blocks-editor', plugins_url('editor.css', __FILE__), array('wp-edit-blocks'), filemtime(plugin_dir_path(__FILE__) . 'editor.css')
|
41 |
+
);
|
42 |
+
|
43 |
+
wp_register_style(
|
44 |
+
'recipe-blocks', plugins_url('style.css', __FILE__), array(), filemtime(plugin_dir_path(__FILE__) . 'style.css')
|
45 |
+
);
|
46 |
+
|
47 |
+
register_block_type('recipe-blocks/ingredients', array(
|
48 |
+
'style' => 'recipe-blocks',
|
49 |
+
'editor_style' => 'recipe-blocks-editor',
|
50 |
+
'editor_script' => 'recipe-blocks',
|
51 |
+
));
|
52 |
+
|
53 |
+
register_block_type('recipe-blocks/details', array(
|
54 |
+
'style' => 'recipe-blocks',
|
55 |
+
'editor_style' => 'recipe-blocks-editor',
|
56 |
+
'editor_script' => 'recipe-blocks',
|
57 |
+
));
|
58 |
+
|
59 |
+
register_block_type('recipe-blocks/directions', array(
|
60 |
+
'style' => 'recipe-blocks',
|
61 |
+
'editor_style' => 'recipe-blocks-editor',
|
62 |
+
'editor_script' => 'recipe-blocks',
|
63 |
+
));
|
64 |
+
|
65 |
+
register_block_type('recipe-blocks/source', array(
|
66 |
+
'style' => 'recipe-blocks',
|
67 |
+
'editor_style' => 'recipe-blocks-editor',
|
68 |
+
'editor_script' => 'recipe-blocks',
|
69 |
+
));
|
70 |
+
}
|
71 |
+
|
72 |
+
add_action('init', 'register_recipe_blocks');
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Registers custom block category
|
76 |
+
*
|
77 |
+
*/
|
78 |
+
function register_recipe_block_category($categories, $post) {
|
79 |
+
return array_merge(
|
80 |
+
$categories, array(
|
81 |
+
array(
|
82 |
+
'slug' => 'recipe-blocks',
|
83 |
+
'title' => __('Recipe Blocks', 'recipe-blocks'),
|
84 |
+
),
|
85 |
+
)
|
86 |
+
);
|
87 |
+
}
|
88 |
+
|
89 |
+
add_filter('block_categories', 'register_recipe_block_category', 10, 2);
|
style.css
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.wp-block-recipe-blocks-details .recipe-detail-container{width:100%;border:1px solid #cdcdd1;border-top:10px solid #bbb;border-collapse:collapse;margin-top:30px;margin-bottom:30px;table-layout:fixed;display:table}.wp-block-recipe-blocks-details .recipe-detail-container .recipe-detail-item{display:table-cell;width:25%;text-align:center;padding-top:15px;border:1px solid #cdcdd1;border-collapse:collapse}.wp-block-recipe-blocks-details .recipe-detail-container .recipe-detail-item .recipe-detail-item-label{border-bottom:1px solid transparent;font-size:21px;font-size:2.1rem;vertical-align:bottom;font-family:"Alegreya Sans SC",serif;font-weight:400;font-style:normal}.wp-block-recipe-blocks-details .recipe-detail-container .recipe-detail-item .recipe-detail-item-value{font-size:16px;font-size:1.6rem;vertical-align:top;font-family:"Alegreya Sans SC",serif;font-weight:400;line-height:25px;padding-bottom:15px}.wp-block-recipe-blocks-ingredients{position:relative;color:#666;background-color:#f5f5f5;border-radius:10px;margin:50px 0;padding:10px 30px 10px 10px;text-align:left}.wp-block-recipe-blocks-ingredients:after{content:"";clear:both;display:table}.wp-block-recipe-blocks-ingredients h4{margin-left:15px;font-size:3.2rem}.wp-block-recipe-blocks-ingredients .ingredients-list{margin:0 0 0 30px;list-style:none}.wp-block-recipe-blocks-ingredients .ingredients-list>li{list-style:none;padding:0 0 10px;margin:0 0 10px;border-bottom:1px solid #dfdfdf;position:relative;line-height:1.7}.wp-block-recipe-blocks-ingredients .ingredients-list>li::before{font-family:dashicons;content:"\f159";display:inline-block;vertical-align:middle;margin:0 15px 0 0;font-size:12px}.wp-block-recipe-blocks-directions{position:relative;margin:50px 0;padding:0;text-align:left}.wp-block-recipe-blocks-directions:after{content:"";clear:both;display:table}.wp-block-recipe-blocks-directions h4{margin-left:15px;margin-bottom:20px;font-size:3.2rem}.wp-block-recipe-blocks-directions .directions-list{counter-reset:count;line-height:normal;list-style:none;margin:0 0 0 30px}.wp-block-recipe-blocks-directions .directions-list>li{position:relative;line-height:1.8;list-style:none;min-height:30px;padding-left:30px;margin:0 0 20px}.wp-block-recipe-blocks-directions .directions-list>li::before{counter-increment:count;content:counter(count);display:block;position:absolute;top:0;left:0;font-size:20px;font-weight:700;font-family:"Alegreya Sans SC",serif;text-transform:uppercase;line-height:1.4;width:35px;vertical-align:middle;padding:0;border-radius:50%;margin-right:10px}.wp-block-recipe-blocks-source{text-align:right;font-style:italic}@media only screen and (max-width:600px){.wp-block-recipe-blocks-details .recipe-detail-container{display:block;padding:10px 0 10px 15px}.wp-block-recipe-blocks-details .recipe-detail-container .recipe-detail-item{display:inline-block;width:100%;padding:0;border:0;vertical-align:middle;text-align:left}.wp-block-recipe-blocks-details .recipe-detail-container .recipe-detail-item .recipe-detail-item-value{display:inline-block;padding:0;vertical-align:middle;font-size:20px;font-size:2rem}.wp-block-recipe-blocks-details .recipe-detail-container .recipe-detail-item .recipe-detail-item-label{vertical-align:middle;padding:0 10px;font-size:23px;font-size:2.3rem}}
|