Lesser Plugin is used, WordPress database will suffer from lesser issues. With Plain CSS and HTML We Can Create WordPress Sidebar Menu Collapsible, Colored and Change on Mouse Over. WordPress Administration itself Uses Such Menu. We can use Icon Font and Twitter BootStrap CSS to give that appearance in very easy way. There is a WordPress Plugin named MenuMaker Lite
, that will give some effect out of the box.
WordPress Sidebar Menu Collapsable With Twitter Bootstrap
I can not show example live on this webpage, view on CodePen live beloved WordPress Sidebar Menu Collapsable. As you can see, I loaded two CSS :
1 2 | <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> |
Plus one extra CSS, in short looks like this :
---
1 2 3 4 5 6 7 8 9 10 | .nav-side-menu { overflow: auto; font-family: verdana; ... ... body { margin: 0px; padding: 0px; } |
Here is another with BootStrap, you can expand the list easily.
WordPress Sidebar Menu, Collapsable With Only CSS3 and Jquery
Here is another example of HTML WordPress Sidebar Menu with Collapsable, icons has not been loaded as path are written as url(../images/sprite.png);
, it is designed Orman Clark and demonstrated in TutPlus :
1 | http://webdesign.tutsplus.com/tutorials/orman-clarks-vertical-navigation-menu-the-css3-version--webdesign-5944 |
You can download the PSD, separate the icons and make CSS Sprite or use Base64 URI Encoding using our tool. Here is the final result :
Conclusion
As shown in the example with jQuery and CSS3, it has the least overhead. But, for that quality of CSS coding, knowledge needed is huge. You can use that one. In such case, you have to manually insert the numbers. Automatic fetching of number of posts from one WordPress category in turn will need a PHP snippet, that will increase load on server.
Furthermore, it is tad hard to echo each value in such way. A plugin is actually better for such usage. The needed PHP for WordPress to fetch number of published posts in one category is a Plugin :
1 2 | https://wordpress.org/plugins/wp-extra-template-tags/ http://www.web-templates.nu/2008/08/25/wp-extra-template-tags/ |
There is another plugin to make PHP get executed in WordPress Widget :
1 | https://wordpress.org/plugins/php-code-widget/ |
Where we wrote :
1 2 3 4 5 | ... <ul class="menu"> <li class="item1"><a href="#">Friends <span>340</span></a> <ul> ... |
that will become :
1 2 3 4 5 | ... <ul class="menu"> <li class="item1"><a href="#">Friends <span><?php _category_count(3); ?></span></a> <ul> ... |