Description

Filter hook that allows modification of widget option names.

Usage

function custom_rw_option_display_name($label, $context) {
if ($label == 'Contact' && $context == 'page') {
	$label = 'Contact Us'; // changes the label to Contact Us page
}
return $label;
}
add_filter('rw_option_display_name', 'custom_rw_option_display_name', 10, 2);

or

function custom_rw_option_display_name2($label, $context) {
if ($context == 'custom_post_type_archive') {
	$label = str_replace(__('Archive', 'df'), '', $label); // strips 'Archive' from for e.g News Archive, Events Archive etc.
}
return $label;
}
add_filter('rw_option_display_name', 'custom_rw_option_display_name2', 10, 2);

Parameters

  • $label | string – (required) an option label (for e.g. Home, Events Archive, Front Page)
  • $context | string – (optional) a context (options group) where the label appears: page, custom_post_type, custom_post_type_archive, category, taxonomy, other, user, language

No replies yet

Be first to start the conversation.

Leave a Reply

Please, do not use this form for technical support. To get support for our plugins, use the support forum.

Your email address will not be published. Required fields are marked *