Hide specific categories from category widget

I know this post is pretty old, but because I came across the same issue and this post came up higher than one with a solution, I figured I’d add this, which worked for me. Source: http://coffeecupweb.com/how-to-exclude-or-hide-categories-from-category-widget-in-wordpress-sidebar/ //Hide categories from WordPress category widget function exclude_widget_categories($args){ $exclude = “1,4,8,57,80”; $args[“exclude”] = $exclude; return $args; } add_filter(“widget_categories_args”,”exclude_widget_categories”);

Where is the content of widgets stored in mysql table

Widget options are stored in the options table under ‘sidebars_widgets’ as a serialized array. See this post for a longer explanation. Changing the field per PHPMyAdmin is not recommended, use PHP, get_option() and update_option() instead, WordPress will take care for correct serialization then.

Conditionally enqueue a widget’s script/stylesheet in HEAD (only when present on page!)

WordPress as a nice function is_active_widget that you can use in your __construct and test if the widget is present in the current page and add your scripts/styles based on that ex: function __construct() { parent::__construct(__CLASS__, ‘BasicWidget’, array( ‘classname’ => __CLASS__, ‘description’ => “This is a basic widget template that outputs text to the sidebar” … Read more

Using widget options ‘outside’ the widget

@JonathonByrd’s answer is probably ‘best’ – certainly you should using get_option if at all possible, since there’s no guarantee the option name will stay the same between WordPress versions. Similarly – @JonathonByrd also relies on using a global variable which may be removed/renamed (though perhaps very unlikely). Unfortunately there are no public wrappers which we … Read more

Can I create my own “Recent Posts” widget or customize the existing one?

It’s usually best to copy the existing one, name it something unique, and then add your own functionality. Copy the WP_Widget_Recent_Posts class from wp-includes/class-wp-widget-recent-posts.php into your functions.php (or, preferably, another file in your theme devoted just to widgets) and rename to something else, like My_Widget_Recent_Posts Add your functionality in there. Don’t forget to call register_widget(‘My_Widget_Recent_Posts’) … Read more

Give Editor Access To Sidebar

The edit_theme_options capability should allow the user to edit the sidebar as described on this page : http://codex.wordpress.org/Appearance_Widgets_SubPanel Code to add to functions.php $role = get_role(‘editor’); $role->add_cap(‘edit_theme_options’); Edit: This should work to prevent editor accessing themes or menus function custom_admin_menu() { $user = new WP_User(get_current_user_id()); if (!empty( $user->roles) && is_array($user->roles)) { foreach ($user->roles as $role) … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)