Skip to content

Advanced Customizing Styling

James K edited this page Jan 16, 2023 · 5 revisions

There are a bunch of ways to change the look and feel of how this plugin generates content on your site.

Filters

tp_include_script_fontawesome

Some components of TouchPoint-WP use icons from FontAwesome. By default, TouchPoint-WP will automatically load FontAwesome from FontAwesome's CDN, only on pages where the icons are needed.

If you use FontAwesome in your theme, we strongly recommend that you use the example below in your functions.php file to prevent FontAwesome from loading multiple times and likely causing weird conflicts.

Example: Prevents TouchPoint-WP from loading FontAwesome.

add_filter('tp_include_script_fontawesome', '__return_false');

tp_include_actions_style

Use this filter to prevent the default Actions CSS from being imported. These CSS rules mostly clean up the formatting of form fields within SweetAlert dialogs. The filter will provide a string for each potential action.

If you're customizing CSS, consider importing the styles from touchpoint-wp/assets/template/actions-style.css and adding something like Example 1 to your functions.php file.

Example 1: Prevents the Actions CSS from being imported in all cases.

add_filter('tp_include_actions_style', '__return_false');

Example 2: Prevents the Actions CSS from being imported, if RSVP is the only action on the page.

function my_exclusion_of_rsvp_action_style($value, $action) {
    if ($action === "rsvp") {
        return false;
    }
    return $value;
}
add_filter('tp_include_actions_style', 'my_exclusion_of_rsvp_action_style');

tp_use_default_templates

By default, TouchPoint-WP provides templates for its post types that will typically work better than generic archive and single templates. However, if you use a specialized templating engine, you may not want this. This filter allows you to disable this functionality. The class name of the post is provided as an argument.

Example: Prevents the default templates from being used in all cases. (We use Timber for our site, and use this.)

add_filter('tp_use_default_templates', '__return_false');

tp_use_css

By default, TouchPoint-WP will require CSS file(s) when needed. If you specifically want to prevent these from being included, set this to false.

Example: Prevents the default css from being used in all cases. (We use this.)

add_filter('tp_use_css', '__return_false');

tp_standardize_html

When HTML is imported form TouchPoint, it is standardized to include only allowed tags, and to standardize header tags (h1, h2, etc.) To bypass this standardization and implement your own, use this filter. Filters are given an extra argument that indicates the context of the standardization.

tp_standardize_allowed_tags

This filter returns an array of strings representing tags that are allowed to be imported from TouchPoint, for HTML strings that are imported from TouchPoint. Filters are given an extra argument that indicates the context of the standardization.

pre_standardize_html

This filter is run before the other HTML standardization processes as part of the HTML import process. Filters are given an extra argument that indicates the context of the standardization.

post_standardize_html

This filter is run after the other HTML standardization processes as part of the HTML import process. Filters are given an extra argument that indicates the context of the standardization.

Clone this wiki locally