Use gettext filter to modify fronted text

This commit is contained in:
Brian Miyaji
2014-06-13 23:21:59 +10:00
parent 89ce3ee84e
commit 5ba33fd629
21 changed files with 90 additions and 124 deletions

View File

@@ -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;