mercredi 4 février 2015

Modifying the walker to insert parent's description above sub menus


I would like to show the title or the description of the parent item on top of the the sub-menu list items. I have basic knowledge on how to modify the walker by calling start_lvl function to insert after <u> or start_el to insert after <li> but couldn't pull the "item->Description" of the parent item to concentrate into the $output var.


such as



<ul>
<li>
<a href="">German Cars</a>
<ul>
<li><a href="">BMW</a></li>
<li><a href="">Mercedes</a></li>
<li><a href="">Volkswagen</a></li>
</ul>
</li>
<li>
<a href="">American Cars</a>
<ul>
<li><a href="">Chrysler</a></li>
<li><a href="">Ford</a></li>
<li><a href="">General Motors</a></li>
</ul>
</li>
</ul>


to show like



<ul>
<li>
<a href="">German Cars</a>
<ul>
<h2>Cars Made in Germany </h2> <!--parent list item's description shows here-->
<li><a href="">BMW</a></li>
<li><a href="">Mercedes</a></li>
<li><a href="">Volkswagen</a></li>
</ul>
</li>
<li>
<a href="">American Cars</a>
<ul>
<h2>Cars Made in the USA</h2> <!--parent list item's description shows here-->
<li><a href="">Chrysler</a></li>
<li><a href="">Ford</a></li>
<li><a href="">General Motors</a></li>
</ul>
</li>
</ul>


Could anybody please guide me here..?





Aucun commentaire:

Enregistrer un commentaire