Plugin Directory

Changeset 703344


Ignore:
Timestamp:
04/25/2013 08:27:33 AM (13 years ago)
Author:
Trendwerk
Message:

3.0.4

Location:
multiple-content-blocks/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • multiple-content-blocks/trunk/README.md

    r698968 r703344  
    2727Additional options
    2828--------------
    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  
    88 *
    99 * @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
    1113 */
    12 function the_block($name,$type='editor') {
    13     echo get_the_block($name,$type);
     14function the_block($name,$args=array()) {
     15    echo get_the_block($name,$args);
    1416}
    1517
     
    1820 *
    1921 * @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
    2127 */
    22 function get_the_block($name,$type='editor') {
     28function get_the_block($name,$args=array()) {
    2329    if(!empty($name)) :
    2430        global $post;
    25         mcb_register_block($post->ID,$name,$type);
    2631       
    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;
    2844    endif;
     45   
     46    return '';
    2947}
    3048
     
    5876    $blocks = get_post_meta($post_id,'mcb-blocks',true);
    5977    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;
    6988        endif;
    7089    endif;
  • multiple-content-blocks/trunk/multiple-content-blocks.php

    r698968 r703344  
    44Plugin URI: https://github.com/trendwerk/multiple-content-blocks/
    55Description: Allow for more content blocks in WordPress than just the one.
    6 Version: 3.0.3
     6Version: 3.0.4
    77Author: Ontwerpstudio Trendwerk
    88Author URI: https://github.com/trendwerk/
  • multiple-content-blocks/trunk/readme.txt

    r698968 r703344  
    55Requires at least: 3.0
    66Tested up to: 3.5.1
    7 Stable tag: 3.0.3
     7Stable tag: 3.0.4
    88
    99Allow for more content blocks in WordPress than just the one.
Note: See TracChangeset for help on using the changeset viewer.