cPOD Kit is modular: each module lives in modules/<id>/, with a module.php that declares its name, dependencies, conflicting plugins and the data to remove on uninstall. Code uses the CPODKit\ namespace and the cpod_ prefix for options, meta, hooks and shortcodes.
Functions #
| Function | Returns |
|---|---|
cpod_module_active( 'pod-profile' ) |
Whether a module is running |
cpod_store_email() |
Store email (Store Variables, else the site admin email) |
cpod_replace_placeholders( $html, $product_id = 0 ) |
Text with {{…}} placeholders replaced |
cpod_sc_get_product_charts( $product_id ) |
Size charts that apply to a product |
cpod_sc_render_chart( $chart_id ) |
HTML of a size chart |
cpod_sc_render_button( $chart_id, $label = '' ) |
HTML of a size guide button |
cpod_sc_get_charts() |
All size charts |
Check function_exists() first, since a module that is off does not load its functions.
Actions #
cpod_loaded: after all active modules have loaded.cpod_sc_loaded,cpod_pp_loaded: after Size Chart / POD Profile have loaded.
Add a placeholder #
add_filter( 'cpod_placeholders', function ( $list ) {
$list['warehouse'] = array( 'label' => 'Warehouse city', 'dynamic' => false );
return $list;
} );
add_filter( 'cpod_placeholder_values', function ( $values, $product_id, $country ) {
$values['warehouse'] = 'US' === $country ? 'Dallas' : 'Rotterdam';
return $values;
}, 10, 3 );
Filters #
- Size Chart:
cpod_sc_charts_for_product,cpod_sc_chart_html,cpod_sc_button_hook,cpod_sc_popup_engine,cpod_sc_show_tab,cpod_sc_tab_priority,cpod_sc_presets. - POD Profile and Estimated Delivery:
cpod_pp_profile_for_product,cpod_pp_shipping_profile_match,cpod_pp_estimate,cpod_pp_dynamic_values,cpod_pp_detail_rows,cpod_pp_details_html,cpod_pp_estimate_html,cpod_pp_est_hook,cpod_pp_product_tabs. - Product Sections and Hook Blocks:
cpod_pp_shipping_html,cpod_pp_returns_html,cpod_ps_set_for_product,cpod_hook_block_html,cpod_hook_block_matches. - Store Variables:
cpod_store_email. - Icons:
cpod_icons. - Admin and front end:
cpod_admin_sections,cpod_settings_tabs,cpod_ajax_data,cpod_frontend_css_vars.
CSS and data #
- CSS classes start with
.cpod-and CSS variables with--cpod-. - Post types:
cpod_size_chart,cpod_product_profile,cpod_ship_profile. - Settings are stored in options starting with
cpod_, product settings in post meta starting with_cpod_.