smitp11 |
Aug 17, 2010 04:14 PM |
[SOLVED] New Template to show child menu pages
Hi,
I have created a new template (a copy of index.php) so I can display child pages links in a menu style. In my template I added this code:
Code:
<div id="nav2">
<div class="clearfix" id="nav-content2">
<ul class="sf-menu2">
<?php
if($post->post_parent)
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
else
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children) { ?>
<ul>
<?php echo $children; ?>
<?php if(function_exists('wp_print')) { print_link(); } ?>
</ul>
<?php } ?>
</ul>
</div>
</div>
right after:
Code:
<?php /* The LOOP starts here. Do this for all posts: */
while (have_posts()) : the_post(); $bfa_ata['postcount']++; ?>
and here is the css for completeness:
Code:
#nav2 { max-height: 350px; }
#nav-content2 { margin: 0 auto; width: 170px; background: url(../../images/topnav.jpg) repeat-x #E5E5E5; border: solid #CCC; border-width: 0px 0px 0px; }
.sf-menu2 { font-weight: normal; max-width: 170px; }
.sf-menu2, .sf-menu2 ul { float: left; padding: 0; margin: 0; }
.sf-menu2 a { display: block; text-decoration: none; padding: 6px 8px; color:#FFFFFF; background-color: #37322F; font-size: 11px; font-weight: bold; text-transform: uppercase; line-height:1.5em; font-family: Helvetica, tahoma, arial; }
.sf-menu2 a:hover { color: #DB1829; }
.sf-menu2 li { padding: 0; line-height: 22px; border-bottom: 1px dashed #FFFFFC; }
.sf-menu2 ul { list-style: none; position: absolute; left: -0em; height: auto; width: 160px; margin: 0; line-height: 1; border: none; }
.sf-menu2 li.current_page_item a { color: #DB1829;}
.sf-menu2 li.current_page_item a, .sf-menu2 ul li .current_page_item a:hover { color: #DB1829; font-weight: bold;}
A demo is here:
http://sandpit.myfallriver.ca/fall-river
As you can see, it isn't quite right.
Any help, much appreciated.
Thanks,
Patrick.
|