Skip to content

Template Overrides

WB Member Wiki uses a template hierarchy that allows theme developers to customize the wiki’s frontend appearance without modifying the plugin directly.

When rendering wiki pages, the plugin checks for templates in this order:

  1. Theme directory: wp-content/themes/{your-theme}/wb-member-wiki/
  2. Plugin directory: wp-content/plugins/wb-member-wiki/templates/

If a matching template exists in your theme, it takes priority over the plugin’s built-in template.

File: single-wiki-page.php

Renders an individual wiki page. The template receives the standard WordPress $post object with wiki-specific content that has already been processed through the content filters (wiki links parsed, TOC added).

Override path:

wp-content/themes/{your-theme}/wb-member-wiki/single-wiki-page.php

File: archive-wiki-page.php

Renders the wiki page archive listing. Displays all published wiki pages in the standard WordPress archive format.

Override path:

wp-content/themes/{your-theme}/wb-member-wiki/archive-wiki-page.php

The dashboard shortcode uses several templates for different views:

Template Purpose
wiki-list.php Dashboard page listing
wiki-edit.php Create/edit page form
wiki-history.php Revision history view
wiki-diff.php Revision comparison view
wiki-search.php Search results
wiki-contributions.php User contribution list

Override path (example):

wp-content/themes/{your-theme}/wb-member-wiki/wiki-list.php

In your active theme, create a wb-member-wiki directory:

wp-content/themes/{your-theme}/wb-member-wiki/

Copy the template you want to customize from the plugin:

wp-content/plugins/wb-member-wiki/templates/single-wiki-page.php

to:

wp-content/themes/{your-theme}/wb-member-wiki/single-wiki-page.php

Edit the copied template in your theme. Your customizations will be preserved across plugin updates.

The single wiki page template has access to:

  • $post - The wiki page post object (standard WP_Post)
  • All standard WordPress template tags (the_title(), the_content(), etc.)
  • Wiki-specific content is already processed through filters before template loading

The edit template receives:

  • $page_id - The page ID being edited (0 for new pages)
  • Access to wiki settings via WBMW_Helpers::get_settings()
  • Permission checks via wbmw_access()->can_edit()
  • $page_id - The wiki page ID
  • Revision data via WBMW_Revisions::get_revisions()

The plugin uses consistent CSS class prefixes for styling:

Class Element
.wbmw-wiki-content Main wiki page content wrapper
.wbmw-wiki-meta Page metadata section
.wbmw-wiki-categories Category badges
.wbmw-wiki-tags Tag badges
Class Element
.wbmw-toc TOC container
.wbmw-toc-header TOC header with title
.wbmw-toc-toggle Show/hide toggle button
.wbmw-toc-list Navigation list
Class Element
.wbmw-wiki-link Link to existing wiki page
.wbmw-wiki-link-new Link to non-existent wiki page
Class Element
.wbmw-editor Editor container
.wbmw-editor-toolbar Editor toolbar
.wbmw-editor-publish Publish button area
Class Element
.wbmw-login-required Login prompt message
.wbmw-no-permission Permission denied message

The plugin enqueues these assets on wiki pages:

  • wbmw-public - Main frontend stylesheet (public/css/wbmw-public.css)
  • select2 - Select2 dropdown styles (4.1.0)
  • wbmw-public - Main frontend JavaScript (public/js/wbmw-public.js)
  • select2 - Select2 dropdown library (4.1.0)

The wbmw_ajax JavaScript object is available on all wiki pages:

wbmw_ajax = {
url: '/wp-admin/admin-ajax.php',
nonce: 'security_nonce',
autosave_interval: 30000, // milliseconds
edit_lock_enabled: 'yes',
i18n: {
saving: 'Saving...',
saved: 'Saved',
error: 'Error saving. Please try again.',
// ... additional i18n strings
}
}
  • Copy, don’t create from scratch - Always start with the plugin’s template and modify it
  • Keep template structure - Maintain the existing HTML structure to ensure JavaScript functionality works
  • Test after plugin updates - When the plugin updates, compare your overrides with the new default templates
  • Use child themes - Place overrides in a child theme to preserve them across parent theme updates
  • Preserve CSS classes - Don’t remove .wbmw- prefixed classes that JavaScript depends on for functionality