NOTE: This is an OLDER guide for BD 3.x–some files have changed. For updated instructions, please visit: https://docs.businessdirectoryplugin.com/
This document describes the general layout of the Business Directory Plugin folder as well as the contents of most of the files and folders inside. The instructions provided here assume that you are an expert in PHP coding, understand HTML very well, and are comfortable with the WordPress PHP API. If you feel that your skills aren't up to par in these areas, you should consider hiring help for your project on a forum such as Upwork or Codeable.io.
CUSTOMIZATION WARNING: Beyond the help provided here, customizations to the plugin are something that you do on your own and without further support from the BD team. We can't provide support on any custom changes you make to the plugin–you must be comfortable in debugging techniques and tools to find and fix issues on your own. Any bugs you find in the plugin must be reproducible with the core, unmodified plugin in order to be considered issues we can address.
Before altering plugin files
- Consider alternative ways to achieve what you want: Business Directory supports CSS customization, template overrides and provides a lot of WordPress filters and actions you can hook into.
- Avoid modifying plugin files unless absolutely necessary. You could end up breaking your site or losing information.
- MAKE A FULL BACKUP BEFORE UPGRADING THE PLUGIN EACH TIME! Please keep in mind that WordPress will remove any modifications you make to the plugin files during plugin upgrades. This is standard WP behavior, so if you forget about it, you'll lose your changes!
Business Directory follows a simple naming convention used to make it easier to figure out what's in a file without opening it.
- The class- prefix is used when the file contains a PHP class and nothing else. For example, class-payment.php contains the
- The view- prefix is used for files that contain views.
Business Directory follows the Model-View-Controller pattern but calls its controllers “views”, just like the Django framework does. Simple views also tend to take care of displaying content themselves, so the term makes sense.
- Templates are suffixed with .tpl.php to differentiate themselves from regular PHP files.
Business Directory folder layout
The following is a general overview of the folder layout used in Business Directory. You'll find a more detailed description for most of the items below in the next section.
|Main plugin file. It takes care of setting everything up including instantiating core APIs such as Form Fields, Settings, etc.
|Basic classes and APIs.
|Deprecated and compatibility code for use with old templates (no longer supported).
|Minified and non-minified CSS files for the frontend.
|Minified and non-minified JS files for the frontend.
|Some images used by BD.
|All frontend templates. Templates that can be overridden in themes are documented here.
|External libraries used by BD such as reCAPTCHA, JWT, jQuery-File-Upload, etc.
|i18n files. Use “WPBDM.pot” as template to create your own translations.
Folder layout in detail
This is the file where it all starts. BD hooks into WordPress, initializes APIs, etc. in this file.
|BD debugging functionality: capture of PHP errors, queries and display of debugging output. Active only when
WP_DEBUG is enabled.
|Various utility functions used by BD.
|Code for Business Directory widgets.
|General purpose functions used through out BD, mostly shortcut methods for API functionality available elsewhere.
|Convenience class to handle AJAX responses.
|CRUD class used to interact with database models.
|The class used by BD for e-mailing.
|Class definition for form field types (textfield, select, URL field, etc.).
|Class definition for form fields. This class is in charge of storing and displaying values for listing fields.
|Class definition for payment gateways. Inherit from this class to implement your own payment gateways.
|Convenience class for working with listings.
|Class definition for payments.
|Class definition for BD views.
|Form field types bundled with BD.
|Form fields API: registration of form fields and types, validation, etc.
|Listings API: upgrades to “Featured”, quick search, renewal notifications, permalink generation, etc.
|Payment API: fees, transactions, IPN handling, etc.
|Functions commonly used in templates.
|Functions affecting listing rendering.
|UI functions available to all templates: search form, sort bar, links on top of Directory pages, etc.
|Checkout procedure view.
|Listing contact view.
|Listing renewal view.
|Listing submit view.
|Listing upgrade view.
|Misc. views: main page, category, tag, search, etc.
Files inside this directory should not be used and are listed here just for completeness. These are legacy files that have been deprecated over time and remain here for reference to folks using older code for template overrides.
WARNING: Do not rely on functionality from these files since they could be removed in future releases.
|Functions that were available in BD 1.x and 2.x that could be still in use in some user templates.
|Custom taxonomy archive template. Analog to WP's
|Custom post type single template. Analog to WP's
All frontend templates are available in this directory.
Some of the templates can be copied to theme directories for customization and will override the defaults.
|Template for listing excerpt view. Can be overridden in themes.
|Template for listing single view. Can be overridden in themes.
|Template for lists of several listings. Can be overridden in themes.
|Main page template. Can be overridden in themes.
|Listing contact form.
|Template for the “Upgrade to Featured” page.
|Template for the “Manage Listings” shortcode.
|Category fee selection.
|Buttons displayed under listings (View, Edit, etc.).
|Template used when login is required.
|Payment page template.
|Template for the “Renew Listing” page.
|Search page template.
|Templates for the listing submit procedure.