Pregunta

Estoy intentando conseguir WordPress para resaltar un elemento específico en mi menú cuando se ve un poste (cualquier puesto). Estoy pensando que la adición de la entrada para el elemento de menú, la pantalla a continuación, la supresión de los submenús podría ayudar, pero mi página 'configuración de menús' no muestra mensajes como los elementos a añadir al menú.

¿Alguien sabe por qué es así, o si hay una mejor alternativa a este método?

Estoy usando una copia del tema TwentyTen defecto que llama wp_nav_menu en header.php.

¿Fue útil?

Solución

You should be able to take the body class (single) and the nav item class (to be determined) and specify the style you'd like to show in the stylesheet. Something like this:

.single .topnav-item-29 {color: #fff; background: #333;}

Otros consejos

As far as i know you should just hit the button on the upper right ("options" - normally you'll find "help" there) and then add posts to it. Yea i know the UI is pretty bad at the moment. Btw: talking about v 3.0.2.

Hmm, unfortunately WordPress doesn't have Posts available by default to just drag into your editable menu. What you can do, however, is use the Links meta box and manually add the Post link. And instead of targeting a class that WordPress tacks onto menu items, that might also change and break your css in the future, you can check your screen options in the upper right of your Menus screen, and make sure you have "CSS Classes" checked in your Advanced Menu Settings.

This way, you can use your own class on that link you created and apply styles to that versus something that WordPress generates.

If you want to add a class dynamically, as in someone clicks this post link and WordPress knows that it's been clicked, and adds another class to the link, perhaps you can try a bit of JQuery - having an on Click event fire whenever that link has been clicked. Depending on how intelligent you need this link to be, you may be stepping into more advanced territory.

Hope the links help! Good luck!

Licenciado bajo: CC-BY-SA con atribución
scroll top