Remove Widgets in Dashboard

I think the best way to go about this is to create a new plugin (or put in the theme function.php but a plugin will always work independent of theme) that disables the widgets you don’t need. Something like this. function wpse_47707_disable_admin_meta() { remove_meta_box( ‘dashboard_browser_nag’, ‘dashboard’, ‘normal’ ); remove_meta_box( ‘dashboard_right_now’, ‘dashboard’, ‘normal’ ); remove_meta_box( ‘dashboard_recent_comments’, … Read more

update_meta_user difference in i:1 and b:1, how to write b:1

Your first serialized string is broken. I can’t spot why but you should not be trying to manipulate capabilities manually. You already have a user object. Use it. if( $new_roles === ‘administrator’ ) { $capabilities = array (“administrator”,’activate_plugins’,’delete_others_pages’,’delete_others_posts’,’delete_pages’,’delete_plugins’,’delete_posts’,’delete_private_pages’,’delete_private_posts’,’delete_published_pages’,’delete_published_posts’,’edit_dashboard’,’edit_files’,’edit_others_pages’,’edit_others_posts’,’edit_pages’,’edit_posts’,’edit_private_pages’,’edit_private_posts’,’edit_published_pages’,’edit_published_posts’,’edit_theme_options’,’export’,’import’,’list_users’,’manage_categories’,’manage_links’,’manage_options’,’moderate_comments’,’promote_users’,’publish_pages’,’publish_posts’,’read_private_pages’,’read_private_posts’,’read’,’remove_users’,’switch_themes’,’upload_files’,’create_product’); $user->set_role(‘administrator’); foreach ($capabilities as $cap) { $user->add_cap($cap); } } Untested but that should work. However, you should … Read more

WP-PageNavi plugin doesn’t work with multiple pages of search results

I discovered that the problem was in my theme’s searchform.php file. I changed the form method from “post” to “get.” Now search queries show up in the url address. Before: <form action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>” method=”post”> After: <form action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>” method=”get”> Problem solved.

How to set value/term of a Woocommerce attribute text field in admin panel?

I am assuming the ID of that text filed, is url-field here is the JS code $(“#url-field”).keyup(function(event) { var url_val=$(“#url-field”).val(); $.ajax({ type:”POST”, url: ajaxurl, data: { action:’use_someprefix_update_url’, search_string:url_val, namefiled : namehere, postid : postidhereYouCangetItIHope }, success:function(data){ alert(“Success, you can remove me 🙂 “); } }); }); Here comes PHP, put this in functions.php function use_someprefix_update_url(){ … Read more

How do you auto-activate plugins from child themes

include this function in your theme and use this hookfunction wp_register_theme_activation_hook($code, $function) { $optionKey=”theme_is_activated_” . $code; if(!get_option($optionKey)) { call_user_func($function); update_option($optionKey , 1); } } functions and examples: <?php /** * Provides activation/deactivation hook for wordpress theme. * * @author Krishna Kant Sharma (http://www.krishnakantsharma.com) * * Usage: * ———————————————- * Include this file in your theme … Read more

Thumb rating for wordpress – top user

there are varaiables in gd rating to sort query. you can use in URL like : http://www.gdstarrating.com/?gdsr_sort=rating&gdsr_order=desc http://www.gdstarrating.com/?gdsr_sort=review&gdsr_order=desc http://www.gdstarrating.com/category/tutorials/?gdsr_sort=votes&gdsr_order=asc or pass to a query query_posts(“gdsr_sort=rating”); query_posts(“gdsr_sort=review&sort_order=asc”); query_posts(“gdsr_sort=rating&gdsr_multi=3”); query_posts(“gdsr_sort=votes&sort_order=asc&gdsr_multi=3”); you can find more info here : http://www.gdstarrating.com/2009/07/03/how-to-reorder-posts/