我想获得帖子发布的正确类别链接!
简单示例:http://news.filmground.host-ed.me/
Look"作者:Elar",接下来应该是类别链接,如"类别:游戏新闻"!
我认为源代码来自插件"类别"
代码在这里
<?php
// =====================================================================
// PLUGIN INFO
// =====================================================================
$_PLUGIN_CONFIG['DATA'] = array(
'author'=>'Diego Najar',
'version'=>'3.6',
'url'=>'http://www.nibbleblog.com'
);
// =====================================================================
// PLUGIN CLASS
// =====================================================================
class PLUGIN_CATEGORIES extends Plugin
{
public function blog_body()
{
global $categories;
$html = '<ul>';
foreach($categories as $category)
{
// URL generator
$href = Url::category($category['slug']);
$html .= '<li class="category"><a href="'.$href.'">'.$category['name'].'</a></li>';
}
$html .= '</ul>';
return $html;
}
}
?>
和这里的页面就在这里
<header>
<h1 class="post-title">
<a href="<?php echo Post::permalink() ?>"><?php echo Post::title() ?></a>
</h1>
<div class="post-published"><span style="font-size:13px"><img alt="Date when post was added!" src="img/dd.png" style="height:13px; margin-bottom:-2px; margin-top:0px; width:13px" title="Date when post was added!" /> Posted on:</span> <?php echo Post::published() ?> | <img alt="Date when post was added!" src="img/au.png" style="height:13px; margin-bottom:-2px; margin-top:0px; width:13px" title="Post author!" /> Author: <a href="">Elar</a></div>
</header>
<div class="post-content">
<?php echo Post::content() ?>
</div>
<footer>
<span class="comment-count">
<?php echo Post::comment_count_link() ?>
</span>
<div class="post-tags"><?php echo Post::tags ()?></div>
</footer>
还有如何在标签之间添加逗号?
<div class="post-tags"><?php echo Post::tags ()?></div>
我正在使用nibbleblog博客脚本!
答案 0 :(得分:1)
对于类别,请尝试将其添加到您的html
<a href="<?php echo Post::category('permalink') ?>"><?php echo Post::category() ?></a>
对于标签,这应该有效:
<?php
$tagLinks = array();
foreach (Post::tags(TRUE) as $tag) {
$tagLinks[] = '<a class="tag" href="' . Url::tag($tag['name']) . '">' . $tag['name_human'].'</a>';
}
?>
<div class="post-tags"><?php echo implode(', ', $tagLinks); ?></div>