How to… Word Press, Themes and NAVT

Introduction

This topic has been written about many times by many people but this article has a NAVT slant. The information presented here is not intended to teach the basics of the PHP programming language, programming logic or WordPress template construction. It is designed to provide sensible help to the do it your-selfer who would like to use the NAVT Plugin for WordPress and isn’t afraid to do a little template hacking to make it happen. However there are at least three different ways you can integrate the NAVT plugin into your theme. Two of them don’t require programming.

The Theme Hack Method

Template or theme hacking is the very thing I hope to prevent you from doing. Adding the necessary function call to your WordPress template for the NAVT plugin doesn’t take very long to do but you need to understand the following:

  • Where the NAVT PHP interface call needs to be placed in your WordPress template,
  • How to correctly write the function call and,
  • How to style the resulting navigation list.

WordPress Theme Basics

WordPress templates are not very mysterious if you understand some basic information. The content of your WordPress theme directory is composed of one large PHP script that is executed every time someone visits your blog. The theme script is divided into small files and each file name provides a clue to its intended use.

The typical WordPress theme usually contains (at a minimum) the following files:

  • index.php
  • header.php
  • sidebar.php
  • footer.php

The index.php file is the start of the PHP script and code execution begins with the very first line at the top of the index.php file and ends on the very last line. index.php is responsible for assembling all of the information that produces the pages of your WordPress blog. Page assembly (or production) is accomplished by making PHP function calls that are designed to create the HTML code that is, in turn, interpreted and displayed by the viewer’s web page browser. If you already know this, bear with me; it gets more interesting later.

There is a method to the madness of producing web pages by your WordPress theme. The method is simply the loading and execution of known PHP files in a predetermined order. The PHP files come from your theme’s directory. Specifically, the files named: header.php, sidebar.php and footer.php. If your theme is missing any one of these files, the file of the same name will be used from the default theme directory in your WordPress installation.

1 Response to “How to… Word Press, Themes and NAVT”


  1. 1 theneuralinvestor

    Very interesting article.

    I have tried to hack my theme with the following code, but without success… basically i just end up with the site showing a blank page and no page source (suggesting a PHP code error)

    Here’s the code:

    <?php (if( function_exists(“navt_getlist”) ) {
    echo “Pages”;
    echo “”;
    navt_getlist(“external”);
    echo “”:
    }
    else {
    ?>

    <a href=”/”>Home

    <a href=”/”>Home

    Would be very grateful if you spotted anything wrong if you could let me know.

    Thamnks

Comments are currently closed.