WordPress.org

Ready to get started?Download WordPress

Forums

Displaying tags across top of page like page menu? (5 posts)

  1. jf80
    Member
    Posted 5 years ago #

    I am trying to make my own theme by adapting a blank one.

    I would like to display the tags across the top of the page where the list of pages is.

    You can see my 'work' so far:
    http://j-dog.co.uk/test/

    See where it says About, Contact etc I would like the tags there instead.

    Any ideas?

    Thanks

  2. Dagon Design
    Member
    Posted 5 years ago #

    Try this in your theme's header.php file (replace the existing menu div):

    <div id="menu">
    <ul>
    <?php
    $tags = get_tags(array('orderby' => 'name', 'order' => 'DESC'));
    foreach ( (array) $tags as $tag ) {
    echo '<li class="page_item"><a href="' . get_tag_link ($tag->term_id) . '" rel="tag">' . $tag->name . '</a></li>';
    }
    ?>
    </ul>
    </div>

    May need a bit of adjustment, but that should do it.

  3. jf80
    Member
    Posted 5 years ago #

    Thank you.

    And if I wanted to display categories I would change 'tag' to 'category' in there?

  4. joe3000
    Member
    Posted 4 years ago #

    Ok that didn't work for categories, anyone else got any idea?

    Thanks.

  5. MichaelH
    Member
    Posted 4 years ago #

    The Amazing Grace theme uses categories in the header nav so might look at how that theme does it:

    http://wordpress.org/extend/themes/amazing-grace

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags