I used some code from Jim Dugan to generate a nav list of children pages. Thank you Jim.
I am using twenty ten theme.
The list of children pages has a bullet in front of it's first page link in the list.
Here is visual of the problem: http://cuyha.com/sidebar-primary/child-sidebar-primary/
I was able to get rid of (using css) the two bullets that showed up on the second listed page but not the first listed page.
Here is the code I used:
if($post->post_parent)
/* if this post has a post_parent make a linked list of the children called $children */
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
else
/* OR if this post IS a post_parent */
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children) {
/* if $children is not empty, make the navblock */
?>
<li class="childnav">
<ul>
<?php echo $children; ?>
</ul>
</li>
<?php } ?>
This is some of the css I have created:
/*
custom sidebars styling */
.childnav ul {
list-style: none;
}
.childnav li a {
list-style: none;
}
.childnav a {
list-style: none;
}
.childnav .page_item li a {
list-style: none;
}
I am creating pages not posts. Could this be part of the problem or is there a twenty ten function or css item I am missing?
Thank you very much.
Nancy
Nilesh shiragave answers:
Change the PHP code with this one
if($post->post_parent)
/* if this post has a post_parent make a linked list of the children called $children */
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
else
/* OR if this post IS a post_parent */
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children) {
/* if $children is not empty, make the navblock */
?>
<ul id="sidebar_nav">
<li class="childnav">
<ul>
<?php echo $children; ?>
</ul>
</li>
</ul>
<?php } ?>
Added <ul id="sidebar_nav">
and add following lines in css
#sidebar_nav,.childnav
{
list-style:none;
}
Or may be try this as you are displaying only one level of you child pages
if($post->post_parent)
/* if this post has a post_parent make a linked list of the children called $children */
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
else
/* OR if this post IS a post_parent */
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children) {
/* if $children is not empty, make the navblock */
?>
<ul id="sidebar_nav" class="childnav">
<?php echo $children; ?>
</ul>
<?php } ?>
Nancy Rodger comments:
This solution worked in an unexpected way.
I first added the new css style as suggested:
#sidebar_nav,.childnav
{
list-style:none;
}
before I added the new php <ul id="sidebar_nav" </ul>>
the bullet disappeared. I double checked with and without the added php.
I am looking at the registered sidebars in the functions.php to see if there is such an id as "sidebar_nav". I do not see one so this is a mystery yet unsolved but IT WORKS ANYWAY!
Thanks you,
Nancy
Nilesh shiragave comments:
Good to hear that your problem is solved with that code.
I just added one ul with sidebar_nav as id because in your sidebar you directly started with <li> and to solve this we have to add either <ul> or <ol> at the start of the code.
Nilesh shiragave comments:
please close this question as we already solved this one.. and award me money.
Andrzej answers:
Here's what I see:
http://nbm.im/20101130-c53-39kb.jpg
http://nbm.im/20101130-7bo-36kb.jpg
Don't see any more bullets? That's PC Firefox 3.
Maybe you need to empty your cache?
Jim Dugan answers:
I'm also not seeing bullets. !important would probably help you.
(You're welcome for the code! Glad it's useful. I'm sure I copied it from someone else.)