Using get_pages to Create Link Buttons to Your Site’s Top-Level Pages
read more
Categories

Using get_pages to Create Link Buttons to Your Site’s Top-Level Pages


If you’re creating a site with some top-level pages that you want to draw visitors’ attention to and encourage them to visit, it helps to have them displayed prominently in your site’s header.Of course you can add top-level pages to your navigation menu, but in this tutorial I’ll show you how to add some extra links to these pages using the get_pages() function.

Note: You don’t have to use this code in your site’s header. If it works better for you, you could always add it to your sidebar or footer by editing the sidebar.php or footer.php files instead of header.php.

In this tutorial I’m going to create a child theme of the twenty sixteen theme and then create a duplicate of twenty sixteen’s header.php file in my child theme, which I’ll edit. You should never edit the files of a theme you’ve downloaded, as then when you update the theme you’ll