从 post nibbleblog 脚本获取类别?
Get category from post nibbleblog script?
我想获得正确的类别 link,其中 post 已 posted!
简单示例:http://news.filmground.host-ed.me/
看"Author: Elar",那之后的下一个类别link应该是"Category: Game News"!
我认为源代码在这里,取自插件"categories"
代码在这里
<?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 博客脚本!
对于类别,请尝试将此添加到您的 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>
我想获得正确的类别 link,其中 post 已 posted!
简单示例:http://news.filmground.host-ed.me/
看"Author: Elar",那之后的下一个类别link应该是"Category: Game News"!
我认为源代码在这里,取自插件"categories"
代码在这里
<?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 博客脚本!
对于类别,请尝试将此添加到您的 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>