Skip to content

Commit

Permalink
Funzione SettingsPage::get_option()
Browse files Browse the repository at this point in the history
  • Loading branch information
Guido W. Pettinari committed Sep 29, 2021
1 parent b608a5f commit fa0874e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/class-settings-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,24 @@ protected function view_template_tabs() {
$this->api->show_forms();
echo '</div>';
}

/**
* Ritorna il valore di un'opzione a partire dalla sua sezione
* e dal suo nome
*
* @param string $option settings field name
* @param string $section the section name this field belongs to
* @param string $default default text if it's not found
* @return string
*/
public static function get_option( $option, $section, $default = '' ) {

$options = get_option( $section );

if ( isset( $options[$option] ) ) {
return $options[$option];
}

return $default;
}
}

0 comments on commit fa0874e

Please sign in to comment.