The Niche Press Directory Publishing System (DPS) is a WordPress plugin that creates a hierarchy of location-based pages on a root page. When the WordPress loop runs, the plugin looks to see if the current page is a NichePress directory page. If it is a directory page, the plugin outputs templated content based on URI query variables. If it isn’t a directory page, the plugin code exits. In this way, the plugin is very efficient and does not add significant overhead to non-directory pages.
Unlike most WordPress directory plugins, NichePress does not make use of the WordPress custom post type capability. The reason for this is that NichePress directories have requirements that are not conducive to the WordPress post system, including:
- Frequent data refresh,
- Templated content, and
- Data merging.
For this reason, most NichePress data are stored in NichePress-specific MySQL tables.
For the purposes of this discussion, we will use a directory of U.S. hospitals to outline NichePress plugin design concepts.
Directory Components
A NichePress directory has the following structure:
- Main Directory Page — This is a standard WordPress page with a custom template type (NichePress). This page generally contains a zipcode search form that allows the user to find listings in a particular location. The type of location can be a U.S. state, county, or city, depending on the directory type (defined in setup).
- Location Pages — Depending on its type, a directory will have 1 or 2 levels of location pages. For instance, a directory set up for State Business Listings has a single level of location pages, U.S. states, whereas a directory set up for City Business Listings has two levels, U.S. states and U.S. cities. These pages contain paragraph content and a list of locations or listings.
- Listing Pages — These are the actual business listings. These pages contain paragraph content and may contain table content.
All pages have access to data variables. The data available is based on page type. Each page type has access to the core data set for its type (e.g., state, city, listing), but additional metadata can be defined and imported at every level, except the main directory page. So, as an example, business listings have data fields for the business name, address, and phone number. However, if you are creating a directory of hospitals, you might also want to know if the hospital offers emergency room services. This information can be imported as metadata to the main listing.
The main directory page is created using a simple template that facilitates full control over both the page content and the page metadata. If desired, the main directory page can also pull in the WordPress page content.
Location pages and listing pages are constructed using a page template and template components, that include:
- Page Metadata Templates — These blocks allow you to create the HTML title, description, and keywords.
- Breadcrumb Template — This template block allows you to create a page breadcrumb structure.
- Page Title Template — This block defines the visible page title.
- Dataset Template — On location pages, this block is used to format links to listings or city/county pages. On listing pages, this block can be used to format listing data.
- Tab Navigation Template — This block is used for page navigation HTML.
- Published Template — This block is used for page publication date HTML.
- Paragraph Templates — There are 9 blocks of paragraphs with 3 versions per paragraph. This allows paragraph content to be randomized for content variation to improve search engine indexing.
- Metadata If-Else Templates — These blocks allow custom output based on the value of a specific metadata element.
- Metadata List-Match Templates — These blocks allow custom output based on a list of values of a metadata element.
- Ad Slot Templates — These blocks (3) allow in-content advertising code to be pushed into different areas of the page.
- Sidebar Widget Area Template — This block allows a custom sidebar to be created.
Templates are stored in the WordPress options table (wp_options) as serialized text fields.
Directory Variables
All directory levels have access to replacement variables. Replacement variables can be core data or imported metadata. A replacement variable is simply the data element name wrapped in braces, such as {var1}, {var2}, {var3}, etc.
Some replacement variables are specific to a template (above). For instance, the variables used to create breadcrumbs are only available in the breadcrumb template. Likewise, variables used to create the listings for a city page are only available in the dataset template.
Metadata variables, for additional data that you import, are available in the page title template, paragraph templates, tab navigation templates, and the main page template.
Content Randomization
Search engine indexing algorithms have a difficult time with directory content that is overly similar on many pages. This is particularly true when talking about multiple listings for a business with many locations. In these cases, the search engine will often kick out all but one listing for the same business.
To get around this issue, NichePress randomizes three variations of each paragraph and paragraph headings. This has the effect of producing page content with the same exact information that is not viewed by the search engines as duplicate content. As a result, the content is more likely to be indexed.
The randomization also has the benefit of making the search engine believe the page content has been updated. By using the randomization function on the control panel, in conjunction with the published template to update the page date, the page content can be refreshed, which entices the search engines to update their index.
This methodology is not the same as spintax, which outputs different content each time a page is generated. NichePress paragraph content remains the same until a directory’s templates are randomized again through the control panel.
Custom Content
NichePress directory templates and replacement variables give directory builders a lot of flexibility, but they can’t handle every situation. Specifically, if a directory page needs data calculations or manipulation, or if a dataset is too large for efficient import, then it will be necessary to create a custom PHP script. NichePress offers a very simple way to create custom output.
The directory options page allows the directory builder to switch on/off custom data at all levels of the directory. When switched on, NichePress looks for the custom script and automatically loads it. The custom script runs after the main code executes and passes the complete page with all replacement variables processed. The custom page script is then free to pull additional data from the database and replace its own variables.
For example, it wouldn’t be feasible or efficient to import hospital quality metrics information as metadata. With hundreds of metrics per hospital, it would bloat the metadata table and the metadata schema does not lend itself to tabular data. In this case, the directory builder can simply import the hospital quality metrics data into its own tables and query the data in the custom script.
Data Import
To get data into NichePress, you import it via CSV files. At each level of a directory, you have the ability to set up import files for listings and metadata.
The primary listing data fields are fixed, but you define where each field is located in the CSV file by column number. If the data is not present in the CSV file, you simply don’t enter a column number.
For metadata, you define the metadata variable name, its location in the import file, a title to use with the variable, and a description of the data. The variable name, title, and description can all be accessed within the templates.
Once data has been defined, and the CSV files are uploaded to an import folder, the data can be imported. Listing data is imported into a listings table that’s shared by all directories, and metadata is imported into a shared metadata table. The import tool uses WordPress AJAX functionality to import data in chunks, which supports large datasets without timing out.
Return to Niche Press Directory Publishing System Main Page