Add current page
This commit is contained in:
parent
7b27e96141
commit
deb0a43d57
@ -31,7 +31,8 @@ class pluginPages extends Plugin {
|
|||||||
{
|
{
|
||||||
global $Language;
|
global $Language;
|
||||||
global $pagesParents;
|
global $pagesParents;
|
||||||
global $Site;
|
global $Site, $Url;
|
||||||
|
$home = $Url->whereAmI()==='home';
|
||||||
|
|
||||||
$html = '<div class="plugin plugin-pages">';
|
$html = '<div class="plugin plugin-pages">';
|
||||||
|
|
||||||
@ -48,15 +49,17 @@ class pluginPages extends Plugin {
|
|||||||
$html .= '<ul>';
|
$html .= '<ul>';
|
||||||
|
|
||||||
if($this->getDbField('homeLink')) {
|
if($this->getDbField('homeLink')) {
|
||||||
$html .= '<li><a class="parent" href="'.$Site->homeLink().'">'.$Language->get('Home').'</a></li>';
|
$current = ($Site->homeLink()==$home) ? ' class="active"' : '';
|
||||||
|
$html .= '<li' .$current. '><a class="parent" href="'.$Site->homeLink().'">'.$Language->get('Home').'</a></li>';
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($parents as $parent)
|
foreach($parents as $parent)
|
||||||
{
|
{
|
||||||
//if($Site->homepage()!==$parent->key())
|
//if($Site->homepage()!==$parent->key())
|
||||||
{
|
{
|
||||||
|
$current_parent = ($parent->slug()==$Url->slug()) ? ' class="active"' : '';
|
||||||
// Print the parent
|
// Print the parent
|
||||||
$html .= '<li><a class="parent" href="'.$parent->permalink().'">'.$parent->title().'</a>';
|
$html .= '<li' .$current_parent. '><a class="parent" href="'.$parent->permalink().'">'.$parent->title().'</a>';
|
||||||
|
|
||||||
// Check if the parent has children
|
// Check if the parent has children
|
||||||
if(isset($pagesParents[$parent->key()]))
|
if(isset($pagesParents[$parent->key()]))
|
||||||
@ -67,7 +70,8 @@ class pluginPages extends Plugin {
|
|||||||
$html .= '<ul>';
|
$html .= '<ul>';
|
||||||
foreach($children as $child)
|
foreach($children as $child)
|
||||||
{
|
{
|
||||||
$html .= '<li><a class="children" href="'.$child->permalink().'">'.$child->title().'</a></li>';
|
$current_child = ($child->slug()==$Url->slug()) ? ' class="active"' : '';
|
||||||
|
$html .= '<li' .$current_child. '><a class="children" href="'.$child->permalink().'">'.$child->title().'</a></li>';
|
||||||
}
|
}
|
||||||
$html .= '</ul>';
|
$html .= '</ul>';
|
||||||
}
|
}
|
||||||
|
3
themes/pure/css/blog.css
Normal file → Executable file
3
themes/pure/css/blog.css
Normal file → Executable file
@ -268,6 +268,9 @@ div.plugin-content li {
|
|||||||
margin-top: 5px;
|
margin-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.plugin-content ul li.active a {
|
||||||
|
color: #2672ec;
|
||||||
|
}
|
||||||
div.plugin-content ul {
|
div.plugin-content ul {
|
||||||
display: block;
|
display: block;
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
|
Loading…
Reference in New Issue
Block a user