ThemeShaper Forums » Thematic

Adding a sitemap to the theme's footer

(1 post)
  • Started 12 years ago by juanojeda
  • This topic is not resolved
  1. I've very recently started using Thematic, and as with all things new I found myself struggling with the ins and outs of making it do what I wanted. I came up with a quick solution that will work perfectly for the current project I'm working on, but I would like a more extensible way of doing the same thing. Read on...

    The brief: Creating a hierarchical sitemap that can be placed into the footer of a template so that each page is only a click or two away.

    My solution:

    //sitemap for footer

    function sitemap_footer(){?>
    <div id="footer-sitemap">
    <h3 class="title">Site directory</h3>
    <div class="sitemap-block"><h3>" title="Home">Home</h3></div>
    <div class="sitemap-block"><h3>/page1" title="page 1">Page 1</h3>

      <?php wp_list_pages('title_li=&child_of=1') ?>

    <div class="sitemap-block"><h3>/page2" title="page 2">Page 2</h3>

      <?php wp_list_pages('title_li=&child_of=1') ?>

    <div class="sitemap-block"><h3>/page3" title="page3">page 3</h3>
    <?php }

    add_filter('thematic_footertext', 'sitemap_footer');


    The reason I used this method of calling the pages individually was so that I could implement CSS that made the parent pages display across the width of the footer, and have the children stacked underneath. with wp_list_pages() the whole lot is displayed in one unordered list, with children in nested lists.

    Possible improvements: What I'd really like is a function that automagically draws the pages and displays them according to whether they have children or not - possibly using a loop with ifs that display parent elements one way and lone elements another.

    This is less of a support query than a discussion of an idea, but as always I definitely appreciate any help I can get!


    Posted 12 years ago #

RSS feed for this topic


You must log in to post.