WordPress.org

Support

Support » Plugins and Hacks » WP Boilerplate Shortcode » [Plugin: WP Boilerplate Shortcode] Not working with WP 3.0.1

[Plugin: WP Boilerplate Shortcode] Not working with WP 3.0.1

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mike Schinkel

    @mikeschinkel

    Hi SnowDemon,

    I’m not sure I know what’s going on with your system (and I’ll try to help you via email anyway) but it was not the plugin. Let’s look at the code and you’ll see there is absolutely nothing in the plugin that could have caused what happen; it’s something else going wrong in your system and my plugin was just the unfortunately bystander:

    WPBoilerplateShortcode::onload();
    
    function the_boilerplate($key,$by='path',$args=array()) {
    	if (in_array($by,array('path','title','id')))
    		$args["by$by"] = $key;
    	echo WPBoilerplateShortcode::boilerplate_shortcode($args);
    }
    
    class WPBoilerplateShortcode {
    	static function onload() {
    		add_action('init', array(__CLASS__,'init_boilerplates'));
    		add_shortcode('boilerplate', array(__CLASS__,'boilerplate_shortcode'));
    	}
    	function init_boilerplates() {
    		if (function_exists('register_post_type')) {
    			register_post_type('boilerplate',
    				array(
    					'singular_label'      => __('Boilerplate'),
    					'label'               => __('Boilerplates'),
    					'exclude_from_search' => true,
    					'publicly_queryable'  => true,
    					'public'              => true,
    					'show_ui'             => true,
    					'query_var'           => 'boilerplates',
    					'rewrite'             => array('slug' => 'boilerplates'),
    					'supports'            => array(
    						'title',
    						'editor',
    						'revisions',
    					),
    				)
    			);
    		}
    	}
    	static function boilerplate_shortcode($args=array()) {
    		$default = array(
    			'bypath' => '',
    			'bytitle' => '',
    			'byid' => '',
    			'id' => '',
    			'class' => 'boilerplate',
    			'title' => '',
    			'showtitle' => false,
    			'titletag' => 'h3',
    		);
    		$args = (object)array_merge($default,$args);
    		if (!empty($args->byid)) {
    			$page = get_page($args->byid);
    		} else if (!empty($args->bypath)) {
    			$page = get_page_by_path($args->bypath,OBJECT,'boilerplate');
    		} else if (!empty($args->bytitle)) { // "bytitle" will only work if this patch is accepted: http://core.trac.wordpress.org/ticket/12743
    			$page = get_page_by_title($args->bytitle,OBJECT,'boilerplate');
    		} else {
    			$page = null;
    		}
    		if (is_null($page))
    			$value = '[ERROR: No "bytitle", "bypath" or "byid" arguments where provided with the boilerplate shortcode' .
    					' or the values provided did not match an existing boilerplate entry.]';
    		else {
    			if (!empty($args->title)){
    				$title = $args->title;
    				$showtitle = true;
    			} else {
    				$title = $page->post_title;
    				$showtitle = $args->showtitle;
    			}
    			$value = (!$showtitle ? '' : "\n<{$args->titletag}>$title</{$args->titletag}>\n");
    			$id = (empty($args->id) ? '' : ' id="' . $args->id . '"');
    			$value =<<<HTML
    <div$id class="$class">$value
    {$page->post_content}
    </div>
    HTML;
    		}
    		return $value;
    	}
    }
    Plugin Author Mike Schinkel

    @mikeschinkel

    Looks like your problem might be the Redirection plugin and not mine?

    If YES maybe you could vote it down and vote mine back up?

    Hi Mike,

    Yes indeed that is the problem. I’m adjusting my ratings now, gladly, and will continue testing your plugin. My rating may go up higher if it can handle my sites needs for single messages included on 30+ pages.

    Thanks very much for your help!

    ~Snow

    P.S. Very sorry I blamed your plugin for the trouble.

    Plugin Author Mike Schinkel

    @mikeschinkel

    Yes indeed that is the problem. I’m adjusting my ratings now, gladly, and will continue testing your plugin.

    Good deal. You had me wondering because I knew it couldn’t have been causing that!

    My rating may go up higher if it can handle my sites needs for single messages included on 30+ pages.

    Ah, so a little friendly extortion, eh? 😉
    I’ll see if I can’t help.

    P.S. Very sorry I blamed your plugin for the trouble.

    And no problem, thanks for updating.

    -Mike

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WP Boilerplate Shortcode] Not working with WP 3.0.1’ is closed to new replies.
Skip to toolbar