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: https://core.trac.www.ads-software.com/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;
}
}