Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Center area post/pages (http://forum.bytesforall.com/forumdisplay.php?f=32)
-   -   [SOLVED] New Template to show child menu pages (http://forum.bytesforall.com/showthread.php?t=8995)

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.

smitp11 Aug 18, 2010 09:13 AM

Ok, I have got a little further with this.

I need to set this for this new template only, is that possible ?
Code:

div.post, div.page {
margin-right: 170px;
}

Thanks.

smitp11 Aug 18, 2010 11:06 AM

Ok, cracked it, I had to add this in the HTML/CSS settings:

Code:

div.post {margin-left: 170px; }
div.post#post-3,div.post#post-49,div.post#post-55,div.post#post-445,div.post#post-376,div.post#post-105,div.post#post-48  {margin-left: 0px; }

So by default all pages have a margin-left of 170px and then I explicitly set the pages I want to have no left margin...


All times are GMT -6. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.