我似乎无法让自定义元数据库显示段落。这是我的代码:
page.php
<?php // Custom Excerpt
$custom_metabox = get_post_meta($post->ID,\'_custom_meta\',TRUE);
if($custom_metabox[\'child-subexcerpt\']!=false) {
echo $custom_metabox[\'child-subexcerpt\'];
} ?>
functions.php
// Custom Meta Box
define(\'_TEMPLATEURL\', WP_CONTENT_URL . \'/\' . stristr(TEMPLATEPATH, \'themes\'));
include_once \'assets/custom/MetaBox.php\';
include_once \'assets/custom/MediaAccess.php\';
// include css to style the custom meta boxes, this should be a global
// stylesheet used by all similar meta boxes
if (is_admin())
{
wp_enqueue_style(\'custom_meta_css\', _TEMPLATEURL . \'/assets/custom/meta.css\');
}
$wpalchemy_media_access = new WPAlchemy_MediaAccess();
$custom_metabox = new WPAlchemy_MetaBox(array
(
\'id\' => \'_custom_meta\', // underscore prefix hides fields from the custom fields area
\'title\' => \'Template Specific Attributes\',
\'types\' => array(\'page\'),
\'template\' => TEMPLATEPATH . \'/assets/custom/mb-pages.php\',
));
meta.php
<?php $mb->the_field(\'child-subexcerpt\'); ?>
<label>Excerpt:</label>
<textarea cols="20" rows="20" class="temp_options_desc" name="<?php $mb->the_name(); ?>"><?php $mb->the_value(); ?></textarea>
请帮助:(
SO网友:helgatheviking
我通常通过复制来解决这个问题the_content
及其默认设置,格式化过滤器。这避免了插件the_content
添加内容。
添加到主题的功能中。php或从何处实现WP Alchemy。
//recreate the default filters on the_content
add_filter( \'meta_content\', \'wptexturize\' );
add_filter( \'meta_content\', \'convert_smilies\' );
add_filter( \'meta_content\', \'convert_chars\' );
add_filter( \'meta_content\', \'wpautop\' );
add_filter( \'meta_content\', \'shortcode_unautop\' );
add_filter( \'meta_content\', \'prepend_attachment\' );
然后应用新的
meta_content
过滤到你想要的内容。
echo apply_filters( \'meta_content\', $your_content );