list subpages with anchor links
-
Hello,
I’d like to output a list of links to the content of subpages. Instead of the
href
being a link out to a separate page, I’d like it to be an anchor to the content of that page, which is displayed below.I’ve figured out how to display the subpage content, and how to give each subpage a unique
id
, but I don’t know how to modifywp_list_pages
so that the links it outputs are anchors instead of full URLs.Up top I have:
<ul> <?php wp_list_pages('&title_li=&child_of='.$post->ID.''); ?> </ul>
And then…
<?php $pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc'); $count = 0; foreach($pages as $page) { $content = $page->post_content; if(!$content) continue; $count++; $content = apply_filters('the_content', $content); ?> <h3 id="<?php echo $page->ID?>"><?php echo $page->post_title ?></h3> <div class="entry-content"><?php echo $content ?></div> <?php } ?>
Any suggestions?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘list subpages with anchor links’ is closed to new replies.