WordPress Roles

Create function to give role a numeric value: function get_user_level($role){ switch ($role) { case ‘Contributor’: return 1; ); break; case ‘Author’: return 2; ); break; case ‘Editor’: return 4; break; case ‘Administrator’: return 5; break; case ‘Super Admin’: return 6; break; default: return 0; // default subscriber or other roles break; } } Now you … Read more

WordPress pre-build slider

No, WordPress does not have a slider feature built in. It will be either a plugin or your theme that has added the slider. For modifying or adjusting your slider, please go to the support area for the plugin/theme you used. If you wish to develop your own, there are many, many tutorials out there … Read more

php include returns 1 as output with other outputs [closed]

First of all, this is not WordPress-specific, and does therefore not belong in WordPress.StackExchange. As it’s so easy to answer, however… include is not a function, but it does return whatever you put in “return” inside the file that’s included. You can use an output buffer to “catch” all output: ob_start(); include TEMPLATEPATH . ‘/apex.php’; … Read more

remove () from category number [closed]

This should make you good to go: $args = array( ‘hide_empty’ => FALSE, ‘title_li’=> __( ” ), ‘show_count’=> 1, ‘echo’ => 0 ); $links = wp_list_categories($args); $links = str_replace(‘</a> (‘, ‘</a> <span>’, $links); $links = str_replace(‘)’, ‘</span>’, $links); echo $links; The ( and ) were in the code. And if you only want to show … Read more

get_option returning a different value from what’s saved

In the plugin_options_validate() function the return value of get_option( ‘plugin_options’ ) is never used. Let’s step through the function by adding some comments: // Retrieve the options. $options = get_option(‘plugin_options’); // Replace the options without checking if // trim( $input[‘text_string’] ) and trim( $input[‘text_string_name’] ) // actually return strings and if $input[‘text_string’] and // $input[‘text_string_name’] … Read more