Use gettext filter to modify fronted text
This commit is contained in:
@@ -43,14 +43,16 @@ class SP_Settings_Text extends SP_Settings_Page {
|
||||
);
|
||||
|
||||
$strings = sp_get_text_options();
|
||||
$options = get_option( 'sportspress_text' );
|
||||
|
||||
foreach ( $strings as $key => $value ):
|
||||
foreach ( $strings as $string ):
|
||||
$settings[] = array(
|
||||
'title' => $value,
|
||||
'id' => 'sportspress_' . $key . '_text',
|
||||
'default' => '',
|
||||
'placeholder' => $value,
|
||||
'type' => 'text',
|
||||
'title' => $string,
|
||||
'id' => 'sportspress_text[' . $string . ']',
|
||||
'default' => '',
|
||||
'placeholder' => $string,
|
||||
'value' => sp_array_value( $options, $string, null ),
|
||||
'type' => 'text',
|
||||
);
|
||||
endforeach;
|
||||
|
||||
@@ -58,6 +60,14 @@ class SP_Settings_Text extends SP_Settings_Page {
|
||||
|
||||
return apply_filters( 'sportspress_text_settings', $settings ); // End event settings
|
||||
}
|
||||
|
||||
/**
|
||||
* Save settings
|
||||
*/
|
||||
public function save() {
|
||||
if ( isset( $_POST['sportspress_text'] ) )
|
||||
update_option( 'sportspress_text', $_POST['sportspress_text'] );
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
Reference in New Issue
Block a user