0
votes

I am a beginner trying to create my own wordpress theme.

I have two nav menus one for the header one for the footer but the secondary one for the footer is not showing up. My code is currently as shown below.

- Functions.php

function base_theme_setup(){

 add_theme_support('menus');

 register_nav_menu('primary','Primary Header Navigation');
 register_nav_menu('secondary','Secondary Footer Navigation');

}

add_action ('init', 'base_theme_setup');

- footer.php

<footer>
<?php wp_nav_menu(array('theme_location'=>'secondary')); ?>

</footer>

<?php wp_footer (); ?>

</body>
</html>
1
Not to sound too simplistic but have you selected the Secondary Menu, within WordPress and assigned it Menu Items?Craig
Yes I have. It all looks fine on the backend it just doesn't show up on the site.Bmoonanhoward
Try changing init to after_setup_theme.Craig
gave it ago but to no effect:(Bmoonanhoward
Go to the site in question and do Ctrl+F5.SIGSTACKFAULT

1 Answers

1
votes

Managed to solve it.

Had some useless undeleted code at the bottom of my index.php. Once deleted the problem went away.

So went from this

<?php

 if( have_posts() ):

    while( have_posts() ): the_post(); ?>

       <h3><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</h3>
       <div class="thumbnail-img"><?php the_post_thumbnail('large'); ?></div>
       <p><?php the_content(); ?></p>
       <small>Posted on: <?php the_time('F j,Y'); ?> at <?php the_time('g:i a'); ?>, in <?php the_category(); ?></small>
       <hr>

<?php   endwhile;

 endif;

 ?>

<?php

            while ( have_posts() ) : the_post();

                get_template_part( 'content', get_post_format() );

            endwhile; 
?>

<?php get_footer();?>

to this

<?php 

 if( have_posts() ):

    while( have_posts() ): the_post(); ?>

      <h3><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>

      <?php the_post_thumbnail('large'); ?>

      <p><?php the_content(); ?></p>

      <small>Posted on: <?php the_time('F j,Y'); ?> at <?php the_time('g:i a'); ?>, in <?php the_category();?></small>

      <hr>

<?php   endwhile;

 endif;

 ?>
 <?php get_footer();?>

Thanks for everyones tips!