EXAMPLES

Extension examples

Start from small standalone plugins that exercise supported WP Trip Summary extension points.

Version
0.3.3
Reviewed
Language
English · fallback
On this page
  1. Enable custom post types
  2. Customize lookup type labels
  3. Add custom front-end viewer tabs
  4. Override the viewer subtitle

Each example is a standalone WordPress plugin. Copy its complete directory to wp-content/plugins, activate WP Trip Summary and then activate the example. Examples left inside the main plugin’s examples directory are not discovered automatically by WordPress.

Enable custom post types

e01-enable-custom-post-types changes the post types for which the trip summary editor is available. Use it together with the post-type availability guide.

Customize lookup type labels

e02-customize-lookup-type-labels filters the labels used for lookup data types without changing plugin core files.

Add custom front-end viewer tabs

e03-custom-frontend-viewer-tabs adds five tabs with local SVG illustrations. It demonstrates:

  • registering tab definitions with abp01_additional_frontend_viewer_tabs;
  • rendering only the example’s tab IDs with abp01_additional_frontend_viewer_tab_content;
  • exposing custom tabs as initial-tab choices;
  • loading local styles and Dashicons without extra JavaScript;
  • preserving the built-in information, map and route-log tabs.

The optional WPTS_E03_TAB_COUNT constant can show all tabs (-1), none (0) or the first one to five entries. Test the example at narrow widths because the viewer keeps a single horizontally scrollable tab row.

Override the viewer subtitle

e04-overriding-viewer-subtitle uses the two-argument abp01_show_frontend_viewer_subtitle filter. The callback receives the current subtitle and the viewer data object, so it can derive a value from $data->postId without relying on the global WordPress Loop.

Return plain text. The default viewer escapes it during rendering. Return null to hide the subtitle.

add_filter(
	'abp01_show_frontend_viewer_subtitle',
	'wpts_override_viewer_subtitle',
	10,
	2
);

Open the example’s README before using it; each directory documents installation, behavior and manual checks.