我有一个快捷码,它遍历自定义帖子类型的列表,并在显示它们时创建一个块。在HTML5中,在标题外有样式块是非法的(可能在其他版本中也是如此,但我们使用的是HTML5)。
我正在寻找一种方法,使我的短代码可以将其块插入头部。有什么建议吗?
这是页面:http://2011.solarteam.org/sponsors/gift-recognition/view-of-living-room
在一个页面上调用两次短代码<像这样一次[interactive slug=\'sponsor-map-living-room\' show="image"]Select an item to learn more about its sponsor.[/interactive]
制作图像<像这样一次[interactive slug=\'sponsor-map-living-room\' show=\'list\' headertitle=\'WaterShed Featured Sponsors: Living Room\' /]
将列表列在底部。
我无法将其放入模板中,因为模板不知道是哪个slug
转到哪一页。
以下是简化版的短代码处理代码:
<ul><?
foreach($map->points as $point){
$result = "";
if(!in_array($point->pointer_type, $all_styles[\'regular\'])){
$all_styles[\'regular\'][$point->pointer_type] = "
.pointer_style_" . $point->pointer_type . " {
width: " . $point->pointer_width(). "px;
height: " . $point->pointer_height(). "px;
background: transparent url(\'/images/interactive/pointers/" . $point->pointer_URL() . "\');
}
";
}
ob_start(); ?>
<li class="tag_point sponsor_data_point pointer_style_<?php echo $point->pointer_type?>" id="point_<?php echo $point->ID ?>" data-in="#point_<?php echo $point->ID ?>_info" data-hover-style="pointer_s_style_<?php echo $point->selected_pointer_type?>" style="left:<?php echo $point->x - ($point->pointer_width()/2) ?>px;top:<?php echo $point->y - ($point->pointer_height()/2)?>px;">
<div class="tag_info" id="point_<?php echo $point->ID ?>_info">
<div class="donation-title"><?php echo $point->contribution ?></div>
<div class="donation-contribution"><?php echo $point->description ?></div>
</div>
<?
$result .= ob_get_clean();
$result .= "</li>\\n";
echo $result;
}
?>
</ul>
<style type="text/css">
<?php echo join("\\n", $all_styles[\'regular\']); ?>
</style>
The<style>
HTML5中不允许使用标记,所以我想把它放在页面的头部。