Thread Starter
js
(@jamisoloman)
One more (sorry!) The ability to add an icon as well as a value. For example with a phone number, I’d like to upload my own icon to display as well.
Thanks!
Hi jam,
1. I added a filter allowing you to decide what is the capability allowed to use Custom Options. The default capability is ‘manage_options’ meaning that only Administrators can change Custom options. Here is an example of code to put in functions.php if you wish to change the default capability to Editors:
function custom_options_capability($capability) {
return 'publish_pages';
}
add_filter('gsp_custom_options_capability', 'custom_options_capability');
The full list of capabilities can be found here: http://codex.wordpress.org/Roles_and_Capabilities
2. I’m not sure what you mean by “a new menu item so it’s not a submenu of the settings”. However, the true focus of this plugin is for people where I work to quickly create options that can be used in the theme and then customized by the client in the admin. Since role and capability management is not the focus of this plugin, I doubt I will consider doing more than creating filters to allow for more flexibility.
3. I just added a new parameter so you can now use get_custom_option( $slug [, $default_value, $field ] ) and specify either “value” or “label” for the $field. The parameters $default_value and $field are optional.
4. If you click the “Help” button in the top right corner you will see a description and examples of code.
5. If you want to use an icon, here is the proper way to do it:
<?php
$value = get_custom_option('slug');
if (!empty($value):
echo '<div class="option">' . $option . '</div>';
endif;
?>
That way you can test if the value is empty and add the icon by CSS background on the div containing the value.
Hope that helps!
[Please post code or markup snippets between backticks or use the code button.]