CubeWP Filters and actions




1: Register scripts for WP-Admin

apply_filters("cubewp-submenu", $pages);
You can use this filter for adding submenu pages on admin.

Usage
function submenu_pages(array $pages) {
$new_pages = array(
array(
'id' => 'New Page',
'parent' => 'cube_wp_dashboard',
'title' => esc_html__('New Page', 'YOUR_TEXT_DOMAIN'),
'callback' => 'new-page',
),
);

return array_merge($pages, $new_pages);
}
add_filter("cubewp-submenu", "submenu_pages");
// Submenu page output
function new_page_callback() {
echo esc_html__('Hello World!', 'YOUR_TEXT_DOMAIN');
}
// Hook name is your submenu page callback but (-) replaced with (_).
add_action("new_page", "new_page_callback");




2: Register scripts for WP-Admin

apply_filters("admin/script/register", $scripts);
This filter contains an associative array of scripts files to be registered for admin.
You can also use this filter if you want to register script file/files for admin.

Usage
function register_admin_script(array $scripts) {
$new_scripts = array(
'script-handle' => array(
'src' => YOUR_PLUGIN_URL . 'assets/js/script.js',
'deps' => array('dep-handle-1', 'dep-handle-2'),
'version' => 1.0,
'has_rtl' => false,
),
);

return array_merge($new_scripts, $scripts);
}
add_filter("admin/script/register", "register_admin_script");




3: Register styles for WP-Admin

apply_filters("admin/style/register", $styles);
This filter contains an associative array of styles files to be registered for admin.
You can also use this filter if you want to register style file/files for admin.

Usage
function register_admin_styles(array $styles) {
$new_styles = array(
'style-handle' => array(
'src' => YOUR_PLUGIN_URL . 'assets/css/style.css',
'deps' => array('dep-handle-1', 'dep-handle-2'),
'version' => 1.0,
'has_rtl' => false,
),
);

return array_merge($new_styles, $styles);
}
add_filter("admin/style/register", "register_admin_styles");




4: Enqueue scripts/styles on WP-Admin

apply_filters("admin/script/enqueue", "");
This filter will be used for enqueueing styles/scripts on wp-admin.

Usage
function enqueue_admin_data(string $data) {
CubeWp_Admin_Enqueue::enqueue_script("script-handle");
CubeWp_Admin_Enqueue::enqueue_style("style-handle");
}
add_filter("admin/script/enqueue", "enqueue_admin_data");




5: Localize data into script files for WP-Admin

apply_filters("cubewp_get_admin_script", $params, $handle);
This filter will be used for localizing data into scripts files for wp-admin.

Usage
function localize_admin_data(array $params, string $handle) {
if ($handle == 'script-handle') {
$params = array(
'ajax_url' => admin_url("admin-ajax.php")
);
return $params;
}
return $params;
}
add_filter("cubewp_get_admin_script", "localize_admin_data", 11, 2);




6: Localize data into specific script file for WP-Admin

apply_filters("{$handle}_params", $data);
This filter will be used for localizing data into specific script file for wp-admin.

Usage
function localize_admin_data_into_file(array $data) {
$params = array(
"redirect_url" => admin_url("admin.php?page=cube_wp_dashboard")
);
return array_merge($params, $data);
}
// YOUR_HANDLE will be your script handle, But (-) replaced with (_).
add_filter("YOUR_HANDLE_params", "localize_admin_data_into_file");




7: Register scripts for frontend

apply_filters("frontend/script/register", $scripts);
This filter contains an associative array of scripts files to be registered for frontend.
You can also use this filter if you want to register script file/files for frontend.

Usage
function register_frontend_script(array $scripts) {
$new_scripts = array(
'script-handle' => array(
'src' => YOUR_PLUGIN_URL . 'assets/js/script.js',
'deps' => array('dep-handle-1', 'dep-handle-2'),
'version' => 1.0,
'has_rtl' => false,
),
);

return array_merge($new_scripts, $scripts);
}
add_filter("frontend/script/register", "register_frontend_script");




8: Register styles for frontend

apply_filters("frontend/style/register", $styles);
This filter contains an associative array of styles files to be registered for frontend.
You can also use this filter if you want to register style file/files for frontend.

Usage
function register_frontend_styles(array $styles) {
$new_styles = array(
'style-handle' => array(
'src' => YOUR_PLUGIN_URL . 'assets/css/style.css',
'deps' => array('dep-handle-1', 'dep-handle-2'),
'version' => 1.0,
'has_rtl' => false,
),
);

return array_merge($new_styles, $styles);
}
add_filter("frontend/style/register", "register_frontend_styles");




9: Enqueue scripts/styles on frontend

apply_filters("frontend/script/enqueue", "");
This filter will be used for enqueueing styles/scripts on wp-admin.

Usage
function enqueue_frontend_data(string $data) {
CubeWp_Enqueue::enqueue_script("script-handle");
CubeWp_Enqueue::enqueue_style("style-handle");
}
add_filter("frontend/script/enqueue", "enqueue_frontend_data");




10: Enqueue styles on frontend

apply_filters("cubewp_enqueue_styles", $styles);
This filter contains an associative array of styles files to be enqueued on frontend without registering.
You can also use this filter if you want to enqueue style file/files for frontend without registering.

Usage
function enqueue_frontend_styles(array $styles) {
$new_styles = array(
'style-handle' => array(
'src' => YOUR_PLUGIN_URL . 'assets/css/style.css',
'deps' => array('dep-handle-1', 'dep-handle-2'),
'version' => 1.0,
'has_rtl' => false,
),
);

return array_merge($new_styles, $styles);
}
add_filter("cubewp_enqueue_styles", "enqueue_frontend_styles");




11: Localize data into script files for frontend

apply_filters("get_frontend_script_data", $params, $handle);
This filter will be used for localizing data into scripts files for frontend.

Usage
function localize_frontend_data(array $params, string $handle) {
if ($handle == 'script-handle') {
$params = array(
'ajax_url' => admin_url("admin-ajax.php")
);
return $params;
}
return $params;
}
add_filter("get_frontend_script_data", "localize_frontend_data", 11, 2);




12: Frontend fields parameters

apply_filters("cubewp/frontend/field/parametrs", $args);
This filter will be used to validate frontend fields parameters.

Usage
function validate_frontend_fields_parameters(array $params) {
$default = array(
'type' => '',
'class' => ''
);
return wp_parse_args($params, $default);
}
add_filter("cubewp/frontend/field/parametrs", "validate_frontend_fields_parameters");




13: Archive layout switcher

apply_filters("cubewp/frontend/archive/list/switcher", $output);
This filter will be used to change archive page layout switcher's output.

Usage
function archive_layout_switcher(string $output) {
$output = /* @lang HTML */
'<div class="cwp-archive-toggle-Listing-style">
<div class="listing-switcher grid-view">
<span class="dashicons dashicons-screenoptions"></span>
</div>
<div class="listing-switcher list-view">
<span class="dashicons dashicons-menu-alt"></span>
</div>
</div>';
return $output;
}
add_filter("cubewp/frontend/archive/list/switcher", "archive_layout_switcher");




14: Sorting filter dropdown options

apply_filters("cubewp/frontend/sorting/filter", "");
This filter will be used to add options into archive page sorting filter dropdown.

Usage
function sorting_filter_options(array $data) {
$options = array(
esc_html__('Price', 'YOUR_TEXT_DOMAIN') => "price"
);
return $options;
}
add_filter("cubewp/frontend/sorting/filter", "sorting_filter_options", 11);




15: Single page taxonomy field output

apply_filters("cubewp/singlecpt/field/taxonomy", $output, $args);
This filter will be used to change output of taxonomy field on single page.

Usage
function single_taxonomy_output(string $output, array $args) {
ob_start(); ?>
<div class="cwp-col-12 <?php esc_attr_e($args['container_class']); ?>">
<h4><?php esc_html_e($args['label']); ?></h4>
<p>
<?php foreach ($args['value'] as $term) { ?>
<a href="<?php echo get_term_link($term); ?>"><?php esc_html_e($term->name); ?></a>
<?php } ?>
</p>
</div><?php

return ob_get_clean();
}
add_filter("cubewp/singlecpt/field/taxonomy", "single_taxonomy_output", 11, 2);




16: Single page text field output

apply_filters("cubewp/singlecpt/field/text", $output, $args);
This filter will be used to change output of text field on single page.

Usage
function single_text_output(string $output, array $args) {
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<p>' . esc_html($args['value']) . '</p>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/text", "single_text_output", 11, 2);




17: Single page number field output

apply_filters("cubewp/singlecpt/field/number", $output, $args);
This filter will be used to change output of number field on single page.

Usage
function single_number_output(string $output, array $args) {
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<p>' . esc_html($args['value']) . '</p>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/number", "single_number_output", 11, 2);




18: Single page email field output

apply_filters("cubewp/singlecpt/field/email", $output, $args);
This filter will be used to change output of email field on single page.

Usage
function single_email_output(string $output, array $args) {
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<p>
<a href="mailto:' . esc_attr($args['value']) . '">
' . esc_html($args['value']) . '
</a>
</p>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/email", "single_email_output", 11, 2);




19: Single page URL field output

apply_filters("cubewp/singlecpt/field/url", $output, $args);
This filter will be used to change output of URL field on single page.

Usage
function single_url_output(string $output, array $args) {
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<p>
<a href="' . esc_url($args['value']) . '">
' . esc_html($args['value']) . '
</a>
</p>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/url", "single_url_output", 11, 2);




19: Single page password field output

apply_filters("cubewp/singlecpt/field/password", $output, $args);
This filter will be used to change output of password field on single page.

Usage
function single_password_output(string $output, array $args) {
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<p>
<input type="password" value="' . esc_html($args['value']) . '" readonly/>
</p>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/password", "single_password_output", 11, 2);




20: Single page textarea field output

apply_filters("cubewp/singlecpt/field/textarea", $output, $args);
This filter will be used to change output of textarea field on single page.

Usage
function single_textarea_output(string $output, array $args) {
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<p>' . esc_html($args['value']) . '</p>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/textarea", "single_textarea_output", 11, 2);




21: Single page editor field output

apply_filters("cubewp/singlecpt/field/wysiwyg_editor", $output, $args);
This filter will be used to change output of editor field on single page.

Usage
function single_editor_output(string $output, array $args) {
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<div>' . wp_kses_post($args['value']) . '</div>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/wysiwyg_editor", "single_editor_output", 11, 2);




22: Single page embed field output

apply_filters("cubewp/singlecpt/field/oembed", $output, $args);
This filter will be used to change output of oembed field on single page.

Usage
function single_oembed_output(string $output, array $args) {
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<div>' . wp_oembed_get($args['value']) . '</div>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/oembed", "single_oembed_output", 11, 2);




23: Single page gallery field output

apply_filters("cubewp/singlecpt/field/gallery", $output, $args);
This filter will be used to change output of gallery field on single page.

Usage
function single_gallery_output(string $output, array $args) {
ob_start(); ?>
<div class="cwp-col-12 <?php esc_attr_e($args['container_class']); ?>">
<h4><?php esc_html_e($args['label']); ?></h4>
<div>
<?php foreach ($args['value'] as $gallery_image_id) {
$gallery_image_url = wp_get_attachment_url($gallery_image_id);
$gallery_image_caption = wp_get_attachment_caption($gallery_image_id);
if (empty($gallery_image_caption)) {
$gallery_image_caption = esc_html__('Gallery Image', 'YOUR_TEXT_DOMAIN');
} ?>
<img src="<?php echo esc_url($gallery_image_url); ?>" alt="<?php esc_attr_e($gallery_image_caption); ?>">
<?php } ?>
</div>
</div><?php

return ob_get_clean();
}
add_filter("cubewp/singlecpt/field/oembed", "single_oembed_output", 11, 2);




24: Single page file field output

apply_filters("cubewp/singlecpt/field/file", $output, $args);
This filter will be used to change output of file field on single page.

Usage
function single_file_output(string $output, array $args) {
$file_URL = wp_get_attachment_url($args['value']);
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<p>
<a href="' . esc_url($file_URL) . '" download>
' . esc_html__('Download File', 'YOUR_TEXT_DOMAIN') . '
</a>
</p>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/file", "single_file_output", 11, 2);




25: Single page switch field output

apply_filters("cubewp/singlecpt/field/switch", $output, $args);
This filter will be used to change output of switch field on single page.

Usage
function single_switch_output(string $output, array $args) {
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<p>' . esc_html($args['value']) . '</p>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/switch", "single_switch_output", 11, 2);




26: Single page dropdown field output

apply_filters("cubewp/singlecpt/field/dropdown", $output, $args);
This filter will be used to change output of dropdown field on single page.

Usage
function single_dropdown_output(string $output, array $args) {
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<p>' . esc_html($args['value']) . '</p>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/dropdown", "single_dropdown_output", 11, 2);




27: Single page checkbox field output

apply_filters("cubewp/singlecpt/field/checkbox", $output, $args);
This filter will be used to change output of checkbox field on single page.

Usage
function single_checkbox_output(string $output, array $args) {
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<p>' . esc_html(implode(', ', $args['value'])) . '</p>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/checkbox", "single_checkbox_output", 11, 2);




28: Single page radio field output

apply_filters("cubewp/singlecpt/field/radio", $output, $args);
This filter will be used to change output of radio field on single page.

Usage
function single_radio_output(string $output, array $args) {
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<p>' . esc_html($args['value']) . '</p>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/radio", "single_radio_output", 11, 2);




29: Single page google address field output

apply_filters("cubewp/singlecpt/field/google_address", $output, $args);
This filter will be used to change output of google address field on single page.

Usage
function single_address_output(string $output, array $args) {
$address = $args['value']['address'];
$lat = $args['value']['lat'];
$lng = $args['value']['lng'];
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<p>
<a href="https://www.google.com/maps?daddr=' . esc_attr($lat) . ',' . esc_attr($lng) . '">
' . esc_html($address) . '
</a>
</p>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/google_address", "single_address_output", 11, 2);




30: Single page date picker field output

apply_filters("cubewp/singlecpt/field/date_picker", $output, $args);
This filter will be used to change output of date picker field on single page.

Usage
function single_date_output(string $output, array $args) {
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<p>' . date_i18n(get_option('date_format'), $args['value']) . '</p>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/date_picker", "single_date_output", 11, 2);




31: Single page date & time picker field output

apply_filters("cubewp/singlecpt/field/date_time_picker", $output, $args);
This filter will be used to change output of date & time picker field on single page.

Usage
function single_date_time_output(string $output, array $args) {
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<p>' . date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $args['value']) . '</p>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/date_time_picker", "single_date_time_output", 11, 2);




32: Single page time picker field output

apply_filters("cubewp/singlecpt/field/time_picker", $output, $args);
This filter will be used to change output of time picker field on single page.

Usage
function single_time_output(string $output, array $args) {
$output = /* @lang HTML */
'<div class="cwp-col-12 ' . esc_attr($args['container_class']) . '">
<h4>' . esc_html($args['label']) . '</h4>
<p>' . date_i18n(get_option('time_format'), $args['value']) . '</p>
</div>';
return $output;
}
add_filter("cubewp/singlecpt/field/time_picker", "single_time_output", 11, 2);




33: Single page repeating field output

apply_filters("cubewp/singlecpt/field/repeating_field", $output, $args);
This filter will be used to change output of repeating field on single page.

Usage
function single_repeating_output(string $output, array $args) {
ob_start(); ?>
<div class="cwp-col-12 <?php esc_attr_e( $args['container_class'] ); ?>">
<h4><?php esc_html_e( $args['label'] ); ?></h4>
<div><?php
$values = $args['value'];
for ( $i = 0; $i < count( $values ); $i ++ ) { ?>
<div class="cwp-row">
<?php foreach ( $values[ $i ] as $k => $value ) {
$field_type = $value['type'];
echo call_user_func( 'CubeWp_Single_Cpt::field_' . $field_type, $value );
} ?>
</div>
<?php } ?>
</div>
</div><?php

return ob_get_clean();
}
add_filter("cubewp/singlecpt/field/repeating_field", "single_repeating_output", 11, 2);




34: Frontend form field output

apply_filters("cubewp/frontend/{$args['name']}/field", $output, $args);
This filter will be used to change output of field of frontend form specified by field name.

Usage
function frontend_form_field(string $output, array $args) {
// Example Code For Textarea Field
$args = apply_filters( 'cubewp/frontend/field/parametrs', $args );
$input_attrs = array(
'id' => $args['id'],
'class' => $args['class'],
'name' => !empty($args['custom_name']) ? $args['custom_name'] : $args['name'],
'value' => $args['value'],
'placeholder' => $args['placeholder'],
'extra_attrs' => $args['extra_attrs']
);
ob_start();
?>
<div class="cwp-field-container">
<label for="<?php esc_attr_e($args['id']); ?>">
<?php esc_attr_e($args['label']); ?>
</label>
<?php echo cwp_render_textarea_input($input_attrs); ?>
</div>
<?php
return ob_get_clean();
}
add_filter("cubewp/frontend/YOUR_FIELD_NAME/field", "frontend_form_field", 11, 2);




35: Frontend search form field output

apply_filters("cubewp/frontend/search/{$args['name']}/field", $output, $args);
This filter will be used to change output of field of frontend search form specified by field name.

Usage
function frontend_search_form_field(string $output, array $args) {
// Example Code For Number Field
$args = apply_filters( 'cubewp/frontend/field/parametrs', $args );
$input_attrs = array(
'id' => $args['id'],
'type' => !empty($args['type']) ? $args['type'] : 'number',
'class' => $args['class'],
'name' => !empty($args['custom_name']) ? $args['custom_name'] : $args['name'],
'value' => $args['value'],
'placeholder' => $args['placeholder'],
'extra_attrs' => $args['extra_attrs']
);
ob_start();
?>
<div class="cwp-field-container">
<label for="<?php esc_attr_e($args['id']); ?>">
<?php esc_attr_e($args['label']); ?>
</label>
<?php echo cwp_render_text_input($input_attrs); ?>
</div>
<?php
return ob_get_clean();
}
add_filter("cubewp/frontend/search/YOUR_FIELD_NAME/field", "frontend_search_form_field", 11, 2);




36: Frontend search filter form field output

apply_filters("cubewp/search_filters/{$args['name']}/field", $output, $args);
This filter will be used to change output of field of frontend search filter form specified by field name.

Usage
function frontend_search_filter_form_field(string $output, array $args) {
// Example Code For Dropdown Field
$args = apply_filters( 'cubewp/frontend/field/parametrs', $args );
$input_attrs = array(
'id' => $args['id'],
'options' => $args['options'],
'class' => $args['class'],
'name' => !empty($args['custom_name']) ? $args['custom_name'] : $args['name'],
'value' => $args['value'],
'placeholder' => $args['placeholder'],
'extra_attrs' => $args['extra_attrs']
);
ob_start();
?>
<div class="cwp-field-container">
<label for="<?php esc_attr_e($args['id']); ?>">
<?php esc_attr_e($args['label']); ?>
</label>
<?php echo cwp_render_dropdown_input($input_attrs); ?>
</div>
<?php
return ob_get_clean();
}
add_filter("cubewp/search_filters/YOUR_FIELD_NAME/field", "frontend_search_filter_form_field", 11, 2);




37: Frontend text field output

apply_filters("cubewp/frontend/text/field", $output, $args);
This filter will be used to change output of text field on frontend.

Usage
function frontend_text_field(string $output, array $args) {
$args = apply_filters( 'cubewp/frontend/field/parametrs', $args );
$input_attrs = array(
'id' => $args['id'],
'type' => !empty($args['type']) ? $args['type'] : 'text',
'class' => $args['class'],
'name' => !empty($args['custom_name']) ? $args['custom_name'] : $args['name'],
'value' => $args['value'],
'placeholder' => $args['placeholder'],
'extra_attrs' => $args['extra_attrs']
);
ob_start();
?>
<div class="cwp-field-container">
<label for="<?php esc_attr_e($args['id']); ?>">
<?php esc_attr_e($args['label']); ?>
</label>
<?php echo cwp_render_text_input($input_attrs); ?>
</div>
<?php
return ob_get_clean();
}
add_filter("cubewp/frontend/text/field", "frontend_text_field", 11, 2);




38: Frontend fields output

apply_filters("cubewp/frontend/{$args['type']}/field", $output, $args);
This filter will be used to change output of text field on frontend.

Usage
function frontend_fields(string $output, array $args) {
// Example Code For Dropdown Field
$args = apply_filters( 'cubewp/frontend/field/parametrs', $args );
$input_attrs = array(
'id' => $args['id'],
'options' => $args['options'],
'class' => $args['class'],
'name' => !empty($args['custom_name']) ? $args['custom_name'] : $args['name'],
'value' => $args['value'],
'placeholder' => $args['placeholder'],
'extra_attrs' => $args['extra_attrs']
);
ob_start();
?>
<div class="cwp-field-container">
<label for="<?php esc_attr_e($args['id']); ?>">
<?php esc_attr_e($args['label']); ?>
</label>
<?php echo cwp_render_dropdown_input($input_attrs); ?>
</div>
<?php
return ob_get_clean();
}
add_filter("cubewp/frontend/FIELD_TYPE/field", "frontend_fields", 11, 2);




39: Frontend form taxonomy field output

apply_filters("cubewp/frontend/{$args['type']}/taxonomy/field", $output, $args);
This filter will be used to change output of taxonomy field on frontend form specified by display type.
EG: checkbox and dropdown.

Usage
function frontend_taxonomy_field(string $output, array $args) {
// Example Code For Dropdown Type Display
$args = apply_filters( 'cubewp/frontend/field/parametrs', $args );
$input_attrs = array(
'id' => $args['id'],
'options' => $args['options'],
'class' => $args['class'],
'name' => !empty($args['custom_name']) ? $args['custom_name'] : $args['name'],
'value' => $args['value'],
'placeholder' => $args['placeholder'],
'extra_attrs' => $args['extra_attrs']
);
ob_start();
?>
<div class="cwp-field-container">
<label for="<?php esc_attr_e($args['id']); ?>">
<?php esc_attr_e($args['label']); ?>
</label>
<?php echo cwp_render_dropdown_input($input_attrs); ?>
</div>
<?php
return ob_get_clean();
}
add_filter("cubewp/frontend/YOUR_DISPLAY_TYPE/taxonomy/field", "frontend_taxonomy_field", 11, 2);




40: Frontend search form taxonomy field output

apply_filters("cubewp/frontend/search/{$args['type']}/taxonomy/field", $output, $args);
This filter will be used to change output of taxonomy field on frontend search form specified by display type.
EG: checkbox and dropdown.

Usage
function frontend_search_taxonomy_field(string $output, array $args) {
// Example Code For Dropdown Type Display
$args = apply_filters( 'cubewp/frontend/field/parametrs', $args );
$input_attrs = array(
'id' => $args['id'],
'options' => $args['options'],
'class' => $args['class'],
'name' => !empty($args['custom_name']) ? $args['custom_name'] : $args['name'],
'value' => $args['value'],
'placeholder' => $args['placeholder'],
'extra_attrs' => $args['extra_attrs']
);
ob_start();
?>
<div class="cwp-field-container">
<label for="<?php esc_attr_e($args['id']); ?>">
<?php esc_attr_e($args['label']); ?>
</label>
<?php echo cwp_render_dropdown_input($input_attrs); ?>
</div>
<?php
return ob_get_clean();
}
add_filter("cubewp/frontend/search/YOUR_DISPLAY_TYPE/taxonomy/field", "frontend_search_taxonomy_field", 11, 2);




41: Frontend search filter form taxonomy field output

apply_filters("cubewp/search_filters/{$args['type']}/taxonomy/field", $output, $args);
This filter will be used to change output of taxonomy field on frontend search filter form specified by display type.
EG: checkbox and dropdown.

Usage
function frontend_search_filter_taxonomy_field(string $output, array $args) {
// Example Code For Dropdown Type Display
$args = apply_filters( 'cubewp/frontend/field/parametrs', $args );
$input_attrs = array(
'id' => $args['id'],
'options' => $args['options'],
'class' => $args['class'],
'name' => !empty($args['custom_name']) ? $args['custom_name'] : $args['name'],
'value' => $args['value'],
'placeholder' => $args['placeholder'],
'extra_attrs' => $args['extra_attrs']
);
ob_start();
?>
<div class="cwp-field-container">
<label for="<?php esc_attr_e($args['id']); ?>">
<?php esc_attr_e($args['label']); ?>
</label>
<?php echo cwp_render_dropdown_input($input_attrs); ?>
</div>
<?php
return ob_get_clean();
}
add_filter("cubewp/search_filters/YOUR_DISPLAY_TYPE/taxonomy/field", "frontend_search_filter_taxonomy_field", 11, 2);