Getting Menu for another page
-
Hello,
I’m developping a website using this theme and I want to get the header for another page (a page created by myself), but the command “<?php get_header(); ?>” is getting only the top bar and the logo, the “nav_menu” hasn’t been shown.
Note: in the source code of this page, I see that have the menu in the header, but it is not shown in the preview.
I hope you can help me!
Grateful already! ??
-
Have you edited the header.php? You may have changed the main menu’s IDs or Classes. I can’t really tell without seeing your actual page.
The theme has page templates that also uses
<?php get_header(); ?>
you can review those or maybe just copy one then modify that instead.First, thanks for reply!
Well, I made a test with page-sitemap.php, just removed the side columns, inserted my html code between the “get_header” and “get_footer” and ran, the same thing happened: still doesn’t show the menu in the preview.
Without the html code it works:
<?php // Template Name: Suporte2 ?> <?php get_header(); ?> "Without code here" <?php get_footer(); ?> With the html code it doesn't works: <?php // Template Name: Suporte2 ?> <?php get_header(); ?> <!DOCTYPE html> <html <?php language_attributes(); ?>> <head> <meta http-equiv="content-type" charset="<?php bloginfo( 'charset' ); ?>" /> <script type='text/javascript' src='https://code.jquery.com/jquery-1.4.2.js'></script> <link rel="stylesheet" type="text/css" href="/css/normalize.css"/> <link rel="stylesheet" type="text/css" href="/css/result-light.css"/> <style type='text/css'> </style> <!--Fun??o para alternancia dinamica dos itens da "árvore de Decis?es"--> <script type="text/javascript" src="jquery-1.3.2.min.js"></script> <script> $(document).ready(function() { $('ul').hide(); $('h3').css('cursor','pointer'); $('h3').click(function(){ $('.show').slideToggle('fast'); }); $('ul li a').click(function(){ $(this).next('ul').slideToggle('fast'); }); }); </script> <title><?php wp_title( '|', true, 'right' ); ?></title> <?php wp_head(); ?> </head> <body <?php body_class(); ?>> <!--"árvore de Decis?es: cada tag <li> contém um item e cada alternancia de um item para outro é "chamada" por uma tag <ul>. OBS: tags <li> com tags <a href> dentro s?o links para trazer uma <ul>. Tags <li> sem links apenas escrevem algo para aparecer na tela--> <div id="post-<?php the_ID(); ?>"> <h3 class="parent">Qual é a sua dúvida ou item observado? - Clique aqui!</h3> <ul class="show"> </li> <li><a href="#"><strong>Chave do Windows 8 indisponível no sistema Assist</strong></a> <ul> <li><strong>Qual mensagem aparece ao tentar gerar a chave?</strong></li> <li><a href="#"><strong>"Placa m?e n?o recebida para este chamado"</strong></a> <ul> <li>Posicionar o recebimento da Placa M?e nova no Assist, conforme página 4 do documento "Manual de Ativa??o do Windows 8 – ATP". <a><strong>Veja!</strong></a></li> <li><strong>A sugest?o ajudou a resolver o problema?</strong></li> <li><a href="#"><strong>Sim</strong></a> <ul> <li>Ok, permanecemos à disposi??o!</li> </ul> </li> <li><a href="#"><strong>N?o</strong></a> <ul> <li>Neste caso, por gentileza entre em contato através do nosso <a><strong>Formulário</strong></a></li> </ul> </li> </ul> </li> <li><a href="#"><strong>"Licen?a para este número de série n?o encontrada"</strong></a> <ul> <li>Através do código do equipamento, verificar na página Manuais de Produtos, qual é o sistema operacional original de fábrica do modelo em quest?o. <a><strong>Veja!</strong></a></li> <li><strong>A sugest?o ajudou a resolver o problema?</strong></li> <li><a href="#"><strong>Sim</strong></a> <ul> <li>Ok, permanecemos à disposi??o!</li> </ul> </li> <li><a href="#"><strong>N?o</strong></a> <ul> <li>Neste caso, por gentileza entre em contato através do nosso <a><strong>Formulário</strong></a></li> </ul> </li> </ul> </li> <li><a href="#"><strong>"Chamado sem troca de placa m?e"</strong></a> <ul> <li>Verificar se houve troca de Placa M?e em chamado(s) anterior(es), onde possivelmente n?o houve a aplica??o da chave baixada na época. Se houve apenas a troca de HDD, consulte o documento "Recovery Eletr?nico e problemas de ativa??o do Windows 8", pois n?o há necessidade de outra chave neste caso. <a><strong>Veja!</strong></a></li> </ul> </li> </ul> </li> </ul> </a></li> <li><strong>A sugest?o ajudou a resolver o problema?</strong></li> <li><a href="#"><strong>Sim</strong></a> <ul> <li>Ok, permanecemos à disposi??o!</li> </ul> </li> <li><a href="#"><strong>N?o</strong></a> <ul> <li>Neste caso, por gentileza entre em contato através do nosso <a><strong>Formulário</strong></a></li> </ul> </li> </ul> </li> <li><a href="#"><strong>Sem mensagem - apenas o quadro vermelho sem nada escrito</strong></a> <ul> <li>Neste caso, por gentileza entre em contato através do nosso <a><strong>Formulário</strong></a></li> </ul> </li> <li><a href="#"><strong>Pe?a n?o cadastrada no Assist</strong></a> <ul> <li>Are you using Linux?</li> <li><a href="#"><strong>YES</strong></a> <ul> <li>Do You Like it?</li> <li><a href="#"><strong>YES</strong></a> <ul> <li>Great!</li> </ul> </li> <li><a href="#"><strong>NO</strong></a> <ul> <li>Too Bad...</li> </ul> </li> </ul> </li> <li><a href="#"><strong>NO</strong></a> <ul> <li>Have You Heard of Linux?</li> <li><a href="#"><strong>YES</strong></a> <ul> <li>Great!</li> </ul> </li> <li><a href="#"><strong>NO</strong></a> <ul> <li>Check it out online!</li> </ul> </li> </ul> </li> </ul> </li> </div> <h3><a href="https://localhost/wordpress/">Voltar</a></h3> </body> </html> <?php get_footer(); ?>
I still hope that you can help me ??
Thanks again!
I think you misunderstood what
get_header()
function does. If you addget_header()
on your template it calls for theheader.php
file. Theheader.php
file naturally contains the header or document<head>
markups. On your template file you calledget_header()
then you manually added the document<head>
markup which duplicates things. If you need to add stuff on the<head>
like the script on your example then you use wp_head action hook.
- The topic ‘Getting Menu for another page’ is closed to new replies.