Theme page menu to custom template (9 posts)

  1. Tony Pratt
    Posted 3 years ago #

    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.

  2. Andrew Nevins
    Forum moderator
    Posted 3 years ago #

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

  3. Tony Pratt
    Posted 3 years ago #


    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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <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-->
  4. Tony Pratt
    Posted 3 years ago #

    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.

  5. Tony Pratt
    Posted 3 years ago #

    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?

  6. Andrew Nevins
    Forum moderator
    Posted 3 years ago #

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

  7. Tony Pratt
    Posted 3 years ago #

    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.

  8. Andrew Nevins
    Forum moderator
    Posted 3 years ago #

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

  9. Tony Pratt
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.