1 (edited by nathan 12-05-2015 00:46:49)

Topic: Category plugin as top navigation menu

Hi Guys,

Loving nibbleblog, so easy to use and setup.

I'm trying to create a top menu based off of the category plugin, so that it displays the categories along the top of all pages, just below the main banner and logo.

So far I've been browsing the code looking for an easy way to do this.

Could someone point me in the right direction?

Thanks in advance.

[EDIT: Sorry, please move this into the General section].

2 (edited by nathan 12-05-2015 00:54:52)

Re: Category plugin as top navigation menu

So far I've written this and placed it just below the header section. However for whatever reason the CSS is scewing the left column, no matter what I try.

<div id="menu"><ul>
<?php
foreach($categories as $cats)
{
    echo '<li><a href="#">' . $cats['name'] .'</a></li>';
}
?>    
</ul></div>    

In main.css I have the following, adjusting the menu ul li width seems to be my main issue.

#menu ul {
    Margin: 0;
    Padding: 0;
    list-style-type: none;
}
#menu ul li {
    width:10%;
    padding:2px auto;
    float:left;
    text-align:center;
    font-weight:normal;
    font-size:12px;
}

Basically all I'm wanting is to have a menu running along the top displaying categories.

Re: Category plugin as top navigation menu

All sorted, kind of what I wanted to achieve, yay!

Here's my blog, it's a short film review site, still adding content as we speak.

http://www.ShortFilmReview.org

Re: Category plugin as top navigation menu

For custom navigation menu:

<ul>
            <?php
               foreach($pages as $page)
            {
               echo '<li><a href="'.$page['permalink'].'">'.$page['title'].'</a></li>';
            }
            ?>
            </ul>

Re: Category plugin as top navigation menu

Excellent! Thanks for sharing your solution!