Menu not working right
-
I have a theme built as a child theme of twenty ten.
I created a custom menu in the menu editor. For the most part it works well.
As part of the theme there is a template page which I do my own stuff in. On that page alone I don’t have the menu. I only get the home link.
I’ve done searching via google and applied all the common variations of coding.
I don’t know what to do now.
Thanks for the help.
Jonathan
-
Can we see the code for your custom page template?
functions.php add_theme_support( "menus" ); if ( function_exists( "register_nav_menus" ) ) { register_nav_menus( array( "top_nav" => "Top Navigation Menu" ) ); }
header.php wp_nav_menu(array('container_class' => 'menu-header', 'theme_location' => 'top_nav' ) );
Also, here is a screenshot of the menu page.
http://i.imgur.com/0CqQ6ug.jpg
Thanks for your help!
Jonathan
Neither of those code snippets is your custom page template.
I’ve altered database related code for public viewing, aside from that, it’s the same thing.
<?php /* Template Name: High Run */ ?> <?php // database connect mysql_connect($dbhost, $user, $password); mysql_select_db($database); ?> <?php get_header(); ?> <div id="container"> <div id="content" role="main"> <?php if (have_posts()) while (have_posts()) : the_post(); ?> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <h1 class="entry-title"><?php the_title(); ?></h1> <div class="entry-content"> <?php the_content(); ?> <?php $sql = "select * from $database.$table"; $results = mysql_query($sql); if ( mysql_num_rows($results) > 0 ) { print "<table><thead>"; print "<tr> <th>Name</th> <th>Province</th> <th>High Run</th> </tr> </thead> <tbody>"; while( $record = mysql_fetch_array($results)) { print "<tr>"; print "<td>" . $record['name'] . "</td>"; print "<td>" . $record['location'] . "</td>"; print "<td>" . $record['value'] . "</td>"; print "</tr>"; } print "</tbody></table>"; } ?> </div><!-- .entry-content --> </div><!-- #post-## --> <?php endwhile; ?> </div><!-- #content --> </div><!-- #container --> <?php get_footer(); ?>
Is the call to
wp_nav_menu()
still in header.php? What happens if you remove all of the custom database stuff?* slams hand down on desk *
yup, the
wp_nav_menu
is in the header.phpIt’s my connection to a secondary database. If I leave everything after the call for
the_content()
, is that safe enough or is there a better way to encapsulate the connection to my own database?Jonathan
I’ve not played with accessing a completely separate db myself – only accessing custom tables in the WP db. so I can’t offer much in the way of direct help here other than to say that this doesn’t surprise me. I’d suggest posting in http://wordpress.org/support/forum/hacks asking for best practice methods of accessing a separate db inside a page template.
Will do. Thanks for your help!
Jonathan
- The topic ‘Menu not working right’ is closed to new replies.