Anthony Hamill
Member
Posted 1 year ago #
Hello all,
I'm trying to create a theme for a single page wordpress theme, very similar to this - http://themetrust.com/demos/solo/
How would you go about creating the nav for this? I was thinking that since I plan on creating each section of the site separately I could just build the nav dynamically, but can't seem to figure out how to make the nav links just be anchor tags...
Also, if anyone has any good direction on how to go about building this type of site, I'd love to hear your suggestions.
Thanks,
Anthony
wood4283
Member
Posted 10 months ago #
I'm looking for the same thing. Any luck find a solution?
Anthony Hamill
Member
Posted 10 months ago #
In order to create the list of anchor tags dynamically, I used wordpress's 'get_pages' function. Here is a copy of the code I used in order to achieve an un-ordered list of the pages in my site.
<ul>
<?php $args = array('sort_column' => 'menu_order');
$pages = get_pages($args);
foreach ($pages as $pagg) : setup_postdata($post);?>
<li><a href="#<?php echo(get_the_title($pagg->ID));?>"class="panel"><?php echo(get_the_title($pagg->ID));?></a></li>
<?php endforeach; ?>
</ul>
Hopefully this helps.
- Anthony
Christopher McMahon
Member
Posted 6 months ago #
An SEO friendly/human readable update to Anthony's code above would be to replace the page ID with the page slug.