Support » Themes and Templates » Theme page menu to custom template

  • I wish to create a series of custom templates containing different size divs, and css styling. The templates will be 95% html with only the php content from the page.php for the inclusion of post content. My new templates are working for the post content but I have not been able to figure out how to include the page menu bar into these custom templates. Thanks in advance.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Andrew Nevins


    For the page menu bar, have you tried wp_nav_menu() function?
    You might want that in the header.php file.


    Thanks, that brought in the menu but it comes in unstyled, like it does not see the css. I have gone over the syntax for the style sheet attachment and I don’t see my mistake. Anyone see the thing I am missing. Thanks again.

    Template Name: Menu
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Demo Site</title>
    <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('stylesheet_directory'); ?>/style.css">
    <div id="wrapper">
      <div id="mainContent">
        <div id="headerContent">
        	<h1 class="weekDay">Day of the Week</h1>
        <div id="menuContent">
            <div id="pageMenu">
                             <?php wp_nav_menu( $args ); ?>
        			<?php while ( have_posts() ) : the_post(); ?>
    					<?php get_template_part( 'content', 'page' ); ?>
    					<?php comments_template( '', true ); ?>
    				<?php endwhile; // end of the loop. ?>
        </div><!--end of menuContent-->
      </div><!--end of mainContent-->
    </div><!--end of wrapper-->

    I took another look at the coding this morning and realized that the div ID containing
    <?php wp_nav_menu( $args ); ?> had to be named “access” instead of what I originally had “pageMenu”. Bare with me I am fairly new at editing custom WP templates and themes.

    It appears I am a little premature in saying success. The menu is there and styled but the links are not being honored. How do I bring in the functionality?

    Moderator Andrew Nevins


    These are the CSS classes wp_nav_menu() uses .
    Specifically, what are you trying to do and what isn’t working?

    I am creating some bare-bones custom page templates containing posts and the same nav_menu contained on the other wp pages. I have been able to get the post function to work along with the nav menu to display correctly with the appropriate css but the links themselves are not functioning on the custom template pages.

    Moderator Andrew Nevins


    Can you post a screenshot of the links “not functioning”, then annotate them here, as to how they should function?

    Put another way the same navigation menu which appears on the stock page templates take you to the linked pages when you click on the link element in a browser. However when the navigation menu appear on my custom page template it looks correct but the text which are supposed to be the links are not, they appear to be static text.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Theme page menu to custom template’ is closed to new replies.