You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+26-1Lines changed: 26 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ It's a PHP class wrapper for handling WordPress [Settings API](http://codex.word
6
6
Usage Example
7
7
---------------
8
8
9
-
A nice tutorial is presented can be found [here](http://tareq.wedevs.com/2012/06/wordpress-settings-api-php-class/) about how to use this PHP class
9
+
A nice tutorial is presented can be found [here](https://tareq.co/2012/06/wordpress-settings-api-php-class/) about how to use this PHP class
10
10
11
11
## Package Installation (via Composer)
12
12
@@ -24,12 +24,37 @@ Now run:
24
24
25
25
`$ composer install`
26
26
27
+
#### Retrieving saved options
28
+
29
+
```php
30
+
/**
31
+
* Get the value of a settings field
32
+
*
33
+
* @param string $option settings field name
34
+
* @param string $section the section name this field belongs to
35
+
* @param string $default default text if it's not found
36
+
*
37
+
* @return mixed
38
+
*/
39
+
function prefix_get_option( $option, $section, $default = '' ) {
40
+
41
+
$options = get_option( $section );
42
+
43
+
if ( isset( $options[$option] ) ) {
44
+
return $options[$option];
45
+
}
46
+
47
+
return $default;
48
+
}
49
+
```
27
50
28
51
Screenshot
29
52
----------------------
30
53
31
54

0 commit comments