Changeset 703344
- Timestamp:
- 04/25/2013 08:27:33 AM (13 years ago)
- Location:
- multiple-content-blocks/trunk
- Files:
-
- 4 edited
-
README.md (modified) (1 diff)
-
assets/inc/functions.template-tags.php (modified) (3 diffs)
-
multiple-content-blocks.php (modified) (1 diff)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
multiple-content-blocks/trunk/README.md
r698968 r703344 27 27 Additional options 28 28 -------------- 29 the_block($name,'one-liner') 30 get_the_block($name,'one-liner') 31 Won't display a WYSIWYG editor, but a plain one line text field (input type="text") 29 the_block($name,array( 30 'type' => 'one-liner', 31 'apply_filters' => false 32 )) 33 - Won't display a WYSIWYG editor, but a plain one line text field (input type="text"). 34 - Won't apply filters -
multiple-content-blocks/trunk/assets/inc/functions.template-tags.php
r698968 r703344 8 8 * 9 9 * @param string $name The name of the block 10 * @param string $type optional The name of the style, either 'editor' or 'one-liner' (defaults to 'editor') 10 * @param array $args Optional. Additional arguments, see get_the_block for more information. 11 * 12 * @return string 11 13 */ 12 function the_block($name,$ type='editor') {13 echo get_the_block($name,$ type);14 function the_block($name,$args=array()) { 15 echo get_the_block($name,$args); 14 16 } 15 17 … … 18 20 * 19 21 * @param string $name The name of the block 20 * @param string $type optional The name of the style, either 'editor' or 'one-liner' (defaults to 'editor') 22 * @param array $args Optional. Additional arguments 23 * array['type'] string The name of the style, either 'editor' or 'one-liner'. Defaults to 'editor'. 24 * array['apply_filters'] bool Whether to apply WordPress content filters. Defaults to true. 25 * 26 * @return string 21 27 */ 22 function get_the_block($name,$ type='editor') {28 function get_the_block($name,$args=array()) { 23 29 if(!empty($name)) : 24 30 global $post; 25 mcb_register_block($post->ID,$name,$type);26 31 27 return apply_filters('the_content',get_post_meta($post->ID,'mcb-'.sanitize_title($name),true)); 32 $defaults = array( 33 'type' => 'editor', 34 'apply_filters' => true 35 ); 36 $args = wp_parse_args($args, $defaults); 37 38 mcb_register_block($post->ID,$name,$args['type']); 39 40 $meta = get_post_meta($post->ID,'mcb-'.sanitize_title($name),true); 41 42 if($args['apply_filters']) return apply_filters('the_content',$meta); 43 if($meta && count($meta) > 0) return $meta; 28 44 endif; 45 46 return ''; 29 47 } 30 48 … … 58 76 $blocks = get_post_meta($post_id,'mcb-blocks',true); 59 77 if(is_array($blocks)) : 60 if(is_array($blocks[sanitize_title($name)])) : 61 $comparable_name = $blocks[sanitize_title($name)]['name']; 62 $comparable_type = $blocks[sanitize_title($name)]['type']; 63 else : 64 $comparable_name = $blocks[sanitize_title($name)]; 65 $comparable_type = 'editor'; 66 endif; 67 if($comparable_name == $name && $comparable_type == $type) : 68 return true; 78 if(is_array($blocks[sanitize_title($name)])) : 79 $comparable_name = $blocks[sanitize_title($name)]['name']; 80 $comparable_type = $blocks[sanitize_title($name)]['type']; 81 else : 82 $comparable_name = $blocks[sanitize_title($name)]; 83 $comparable_type = 'editor'; 84 endif; 85 86 if($comparable_name == $name && $comparable_type == $type) : 87 return true; 69 88 endif; 70 89 endif; -
multiple-content-blocks/trunk/multiple-content-blocks.php
r698968 r703344 4 4 Plugin URI: https://github.com/trendwerk/multiple-content-blocks/ 5 5 Description: Allow for more content blocks in WordPress than just the one. 6 Version: 3.0. 36 Version: 3.0.4 7 7 Author: Ontwerpstudio Trendwerk 8 8 Author URI: https://github.com/trendwerk/ -
multiple-content-blocks/trunk/readme.txt
r698968 r703344 5 5 Requires at least: 3.0 6 6 Tested up to: 3.5.1 7 Stable tag: 3.0. 37 Stable tag: 3.0.4 8 8 9 9 Allow for more content blocks in WordPress than just the one.
Note: See TracChangeset
for help on using the changeset viewer.