Plugin / Icon Table of Contents and Menus

David Lenton

Installation

Installation

Once you have installed and activated the plugin there are two functions available to use in your WordPress templates:

  • icon_toc_page()
  • icon_toc_navigation(array())

The first of these is used to generate a table of contents (ToC) for your current page. To call it, you need to edit the appropriate template (for example, page.php) and insert the following line just before the WordPress function the_content() is called:

<?php if (class_exists('Netf_Toc')) { icon_toc_page(); }    ?>

It doesn’t take any parameters. This will generate the ToC icon under the main heading on the page.

If need be, you can amend the look of the ToC by extending the existing toc.css styles. More information can be derived from the main stylesheet, but to change the main colours you just need to add new values for:

.toc {
background-color: #fafafa;
border-color: #ddd;
}

Some colours will work better than others.

icon_toc_navigation() is used to display one or more of the menus you have set up for your WordPress site. Use the following code, replacing ‘menu_1’ and ‘menu_2’ with the names of the WordPress menus you want to display. You can add as many menus as you like to the array. Even if you’re only calling one menu it must be passed as an array:

<?php   
if (class_exists('Netf_Toc')) {
    icon_toc_navigation(array('menu_1','menu_2'));
} 
?>

This will work anywhere, but the expectation is that it will be called within the header of the page.

If you’re going to put the ToC in the header, you might want to specify a specific position for it and set it to display over other content using an appropriate z-index value. For example:

header .toc {
    position: absolute;
    top: 0em;
    right: 0.5em; 
    display: block;
    z-index: 1;
}   

In addition, you’ll probably need to amend the CSS of the element within which the TOC is set to display (the containing element) so that it allows content to be displayed outside of its bounding box by setting overflow to visisble. So, for example, if the container element is the header, then:

header {
    overflow: visible;
}

You may also want the navigation menu to only appear in certain circumstances, for example when the width of the browser is small (I use it in this way to replace other forms of navigation on a site). To do that, you’ll need something like this in the main CSS:

header .toc {
    display: none;
}

And a suitable @media entry:

@media (max-width: 767px) {
    header .toc {
        display: block;
    }   
}

Ratings

0
0 reviews

Rating breakdown

Details Information

Version

1.2

First Released

01 Nov, 2013

Total Downloads

820

Wordpress Version

3.0.1 or higher

Tested up to:

3.7.28

Require PHP Version:

-

Tags

Contributors

Languages

The plugin hasn't been transalated in any language other than English.

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.