Show the page selected in the menu
-
Hi everyone,
I’m creating a theme that makes a menu out of every page that is made within the WordPress Dashboard. Now, I want my theme to show a page when this page is selected in the menu (e.g.: someone clicks “Contact” in the menu, and then the Contact page opens) and this seems downright impossible to do.
I tried to make an if / else statement but it didn’t seem to make any sense. I have very little experience with WordPress and PHP, so it might just be me. Anyway, this is the code that I have so far:
First, the menu (located in header.php):
<?php wp_nav_menu (array ('items_wrap' => '%3$s') ); ?>
This is what I have to call a page, but it only calls the most recent page I have made (located in index.php):
<?php query_posts('showposts=1&post_type=page); ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <h2> <?php the_title(); ?></a> </h2> <?php the_content(); ?> <?php endwhile; " " ?> <?php else: " " ?> <?php endif; ?>
If someone could help me out, that’d be great! ^_^
- The topic ‘Show the page selected in the menu’ is closed to new replies.