Come posso visualizzare un menu solo su determinate pagine?
-
-
Penso che dipenda daltuotema.Ma comepunto dipartenza http://codex.wordpress.org/Navigation_Menus dovrebbe aiutare !!I think it depends on your theme. But as a starting point http://codex.wordpress.org/Navigation_Menus should help!!
- 0
- 2014-06-20
- sri
-
Ahia.Penso che sia un'opzionenativa di Joomla,apparentementenonin WordPress.Periltuo sito,potresti crearefile di outputpersonalizzati category/pages.phpe quindi aggiungere unmenupersonalizzato unico lì,ma questo è un vero dolore al collo.Avresti quattropagine .php di outpute quattromenu unici,unoper ciascuna selezione sopra.Unmodo sempliceperimplementare è utilizzarei widget dellabarra laterale come strumento dinavigazioneprincipale.lo strumento widgetmenupersonalizzato èpiuttosto semplice.Crea unmenuper ognipagina,supponendo chetu abbiamodelli univociper ciascuna.Nota,sidebarnon è laparolamigliore.Puoimettere un widget ovunque.Ouch. I think that is a native Joomla option, apparently not in WordPress. For your site, you could create custom output category/pages.php files and then add a unique custom menu there but that is a total pain in the neck. You'd have four output .php pages and four unique menus, one for each selection above. One easy way to implement is to use sidebar widgets as your primary navigation tool. the custom menu widget tool is pretty simple. Create a menu for each page, assuming you have unique templates for each. Note, sidebar is not the best word. You can put a widget anywhere.
- 0
- 2014-06-20
- zipzit
-
Sono a conoscenza dellebarre lateralie dei widget.Questepiccoleparti del sito Web chenon sono collegate a unapagina.Non voglio usarebarre lateralie widgete li ho disabilitatiperchénonne usonessuno.Ad ognimodo,penso che leposizioni delmenu sianoimpostazioni delmenu,non un'impostazione di un widget che contiene unmenu.I am aware of the sidebars and widgets. These small website parts that are also not connected to a page. I don't want to use sidebars and widgets and have disabled them because I don't use any of them. Anyway, I think the menu locations are settings of the menu, not a setting of a widget which contains a menu.
-
Latua domanda è semplicemente "Comefaccio ad aggiungereimpostazioni dimenupersonalizzate?"o è anche "Comeposso utilizzare leimpostazioni dimenupersonalizzateper visualizzare unmenu solo su determinatepagine?"?Is your question just "How do I add custom menu settings?" or is it also "How do I use custom menu settings to display a menu on certain pages only?"?
- 0
- 2014-06-20
- engelen
-
7 risposta
- voti
-
- 2014-09-14
È unabuona opzione,ma sono d'accordo con sri,in questomomento dipende davvero daltuotema. Puoi risolvereilproblematramite is_page () .Devi scrivere qualcosa delgenere sultuofile deltema page.php :
<?php if (is_page('projects')) { if ( is_active_sidebar( 'sidebar-navigation' )) { dynamic_sidebar( 'sidebar-navigation' ); } } ?>
Se desiderimostrare labarra laterale anche su altrepagine,puoi utilizzare la logica o in questomodo:
if (is_page('projects') || is_page('home') || is_page('post-page'))
That's a nice option, but I agree with sri, right now it really depends on your theme. You can do a work-around through is_page(). You need to write something like this on your page.php theme file:
<?php if (is_page('projects')) { if ( is_active_sidebar( 'sidebar-navigation' )) { dynamic_sidebar( 'sidebar-navigation' ); } } ?>
If you want to show the sidebar on other pages as well, you can use logic or like this:
if (is_page('projects') || is_page('home') || is_page('post-page'))
-
Non conosco una soluzionemigliore,ma questa è davvero una cattivapraticanelmondo dellaprogrammazione.Stopensando che almenoforseeseguireil ciclo attraverso un array o qualcosa delgenere,quindieseguire lo scambio dimenu.Sicuramente apprezzo la rispostaperò.*Sospiro*I don't know of a better solution, but this is really bad practice in the coding world. I'm thinking that at the very least maybe loop through an array or something then perform menu swap. Definitely appreciate the answer though. *Sigh*
- 0
- 2016-02-04
- BRogers
-
- 2014-07-14
Penso che usare unpluginper questo siameglio,cosìpuoimantenere lafunzionalità anche se cambitemi infuturo.Dai un'occhiata a questoplugin.Fa quello che vuoi,main modo leggermente diverso da come l'hai deriso.
https://wordpress.org/plugins/page-specific-menu-items/
Se questo aiuta,perfavore vota o accetta come risposta.Grazie!
I think using a plugin for this is better, so you can keep the functionality even if you change themes in the future. Check out this plugin. It does what you want, but slightly differently than how you mocked it up.
https://wordpress.org/plugins/page-specific-menu-items/
If this helps, please up vote or accept as the answer. Thanks!
-
Se hai solo unmenuin tuttoil sitoe vuoi solonascondere determinati collegamentiin quelmenu quando un utente sitrova su una determinatapagina,questoplugin lofa.Dopo aver selezionatoiltipo di articoloin cui desideri visualizzareilmenu (lapagina è ciò che desideri,opiù),vai amodificare unapaginae puoi controllarei collegamenti che desiderinascondere.Quest'altro lofanelmodo opposto.Seleziona unmenu da unmetaboxnella schermata dellapagina dimodifica,quindi haibisogno dipiùmenutra cui scegliere: http://wordpress.org/plugins/ce-wp-menu-per-page/If you only have one menu across the site, and you just want to hide certain links in that menu when a user is on a certain page, this plugin does that. After you select the post type you want the menu on (page is what you want, or more) then go to edit a page, and you can check the links you want hidden. This other one does it the opposite way. You select a menu from a metabox on the edit page screen, so you need multiple menus to choose from: http://wordpress.org/plugins/ce-wp-menu-per-page/
- 0
- 2014-07-15
- Mark.C
-
- 2014-11-05
Ecco comepuoifarloin Twenty Twelvethemes header.php copiatoin un childtheme.
<?php if ( is_page('projects') ) : ?> <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu' => 'conditional-menu-name', 'menu_class' => 'nav-menu' ) ); ?> <?php else : ?> <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu' => 'Primary', 'menu_class' => 'nav-menu' ) ); ?> <?php endif; ?>
Crea unnuovomenu conglielementi che desideri visualizzaree sostituisciilnome delmenu condizionalenel codice sopra conilnome deltuomenu.
Inomi dimenu_classpotrebbero dover cambiarepertemi diversi da Twenty Twelve.
This is how you can do it in Twenty Twelve themes header.php copied to a child theme.
<?php if ( is_page('projects') ) : ?> <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu' => 'conditional-menu-name', 'menu_class' => 'nav-menu' ) ); ?> <?php else : ?> <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu' => 'Primary', 'menu_class' => 'nav-menu' ) ); ?> <?php endif; ?>
Create a new menu with the items you want to display and swap out the conditional-menu-name in the above code with the name of your menu.
menu_class names may need changing for themes other than Twenty Twelve.
-
- 2015-11-14
So che questothread è vecchiomanel caso qualcuno avessebisogno di cercare una rispostaper questo,vorrei suggerirei menu condizionali dathemify https://themify.me/conditional-menus .Sceglitu qualemenu usare,perpagina,categoria,meta,tutto.ed ègratuito :) spero che questo aiuti
I know this thread is old but in case someone would need search for answer for this, I would like to suggest the conditional menus from themify https://themify.me/conditional-menus. You choose which menu to use, per page, category, meta, everything. and it is free :) hope this helps
-
- 2014-06-20
Se sei disposto a coinvolgerenuovamentei tuoi widgete desideri una soluzione semplice,puoi utilizzare unplug-in chiamato Display Widgets.Ho usato questoe uso laparte ditestoin cuipuoi aggiungere collegamenti a dove vuoi andare.Funziona sia chei link siano sultuo sito o su un altro sito.Ha uno spazio sottoiltesto dovepuoi scegliere qualipaginemostrare onascondere.Puoi comunque rimuoverei widget chenon utilizzi.
Hogiocato coni menuper unpo 'prima di cercaree trovare questoplugin.Funzionabene.
Puoitrovarlonella sezione Plugin di WordPress.org.
If you are willing to re-engage your widgets and want a simple solution, you can use a plugin called Display Widgets. I have used this and use the text portion where you can add links to where you want to go. It works whether the links are on you own site or to another site. It has a space down below the text where you can choose which pages to show or hide. You can still remove the widgets that you do not use.
I played around with the menus for quite a while before I looked for and found this plugin. It works well.
You can find it in the Plugins section of WordPress.org.
-
Graziemille!Manon sto cercando unplugin aggiuntivo.Enon utilizzoi widgetpoiché questepartimobili del sito Web sonotroppo difficili da comprendereper alcuni deimiei clienti.Thank you very much! But I am not looking for an extra plugin. And I don't use widgets since these floating website parts are too hard to understand for some of my customers.
-
- 2014-07-23
Un'opzione sarebbe crearemodellipersonalizzatiper ognimenu che hai.(Si riferisce alla casella di controllo delleposizioni deltema) Quindiin ognipagina,scegliilmodello che desideri venga utilizzatoe utilizzerà ancheilmenu associato a quelmodello.
https://codex.wordpress.org/Page_Templates
Ti dà lo stesso risultato chepensotu stia cercando,mainvece di dire a ciascunmenuin qualepagina viene visualizzato,dirai a ciascunapagina qualemenu verrà visualizzato su diesso.Un ulteriore vantaggio difarloin questomodo è chenon c'èmodo di dire accidentalmente a duemenu ditrovarsinello stessopostonello stessomomento.
One option would be to make custom templates for each menu that you have. (That refers to the theme locations check box) Then on every page, you choose the template that you want it to use and it will also use the menu associated with that template.
https://codex.wordpress.org/Page_Templates
It gives you the same result I think you are looking for but rather than telling each menu what page it shows on, you will be telling each page what menu will show on it. An added benefit of doing it this way is that there is no way for you to accidentally tell two menus to be in the same place at the same time.
-
Sì,hoguardato questo.Ma lo sviluppatorenon samai di quantimenu habisogno l'utente.Quindi devo crearemoltimodelliper coprirlitutti.`template_a.php`,`template_b.php`,`template_c.php`ecc.Yes, I have looked at this. But the developer never knows how many menus the user needs. So I have to create a lot of templates to cover them all. `template_a.php`, `template_b.php`, `template_c.php` etc.
-
- 2016-04-17
Puoi usareilplugin Menu Swapper perfare la stessa cosa dalpannello di amministrazione. Ecco la Demo di questoplug-in.
You can use Menu Swapper plugin for doing same thing from admin panel. Here is the Demo of this plugin.
Invece di usarei widget dellabarra lateraleper dire su qualepagina dovrebberoessere visibili,mi piace sceglierenelleimpostazioni delmenu di apparire supagine specifiche.
Metodo Wordpresspredefinito:
Quindiprogetti è unapaginae ha alcune sottopagine.Ma cosa succede se ho altre 10 di questepaginee sottopagine con la stessa situazione?
Vorrei aggiungere un'impostazioneextra (unelenco dellepagine diprimo livello):
Manon riesco atrovare documentazione,azioni,filtriecc. quando vengono caricate questeimpostazioni.