Can i put images in navigation in wordpress
I want some of <li>
to be with text ex: Home and some of them to be images Ex:facebook’s logo for <li>
named Facebook.
Is there any possible way to catch the text content of the li in wordpress
with php or JS may be ??
It is easy to catch it if the navigation is statically written but in WP it is dynamically loaded and looks something like this :
<?php
wp_nav_menu(array(
'theme-location' => 'nav',
'container' => 'nav'
));
?>
Thanks ( :
The easiest and probably the best way to do is is this:
Add a CSS class to the menu item you want to include an image. You can add these CSS classes from the default Worpress Admin under
Appeareance -> Menus
If you open that page you can click the down arrow on the menu item you want to add a class to. Then a input field
CSS Classes (optional)
appears. Enter a usefull CSS class name (likefacebook-image
) hereIf you don’t see that option; check the settings under
Screen options
(top right on the menus page)