Inherit plugin settings to new site in Multisite

Nice Question! But I’ll leave for the asker and for the reader the task of finding the plugin options name. This can be used for any plugin/theme that relies in a single/serialized value in the wp_options table. If it’s not a single value, it’s another task… In this example, I’m using WP-Pagenavi option_name. Action hook … Read more

Creating a user’s own folder on user registration

You can use the user_register action to hook into the register proces and then create the user directory with wp_mkdir_p. function create_user_dir($user_id) { $user_info = get_userdata( $user_id ); $upload_dir = wp_upload_dir(); $user_dir = $upload_dir[‘basedir’] . ‘/user_dirs/’ . $user_info->user_login; wp_mkdir_p($user_dir); } add_action( ‘user_register’, ‘create_user_dir’); This example makes a directory in uploads/user_dirs. http://codex.wordpress.org/Plugin_API/Action_Reference/user_register http://codex.wordpress.org/Function_Reference/wp_mkdir_p

Adding a Variable Product in WooCommerce Programatically

Found the solution to make a product attribute, a variation. Lets say we have: wp_set_object_terms( $post_id, ‘XL’, ‘pa_size’ ); Above is a custom attribute (a size attribute). In order to make it a variation you need to do this: $thedata = Array(‘pa_size’=>Array( ‘name’=>’pa_size’, ‘value’=>”, ‘is_visible’ => ‘1’, ‘is_variation’ => ‘1’, ‘is_taxonomy’ => ‘1’ )); update_post_meta( … Read more

Lightbox popup on WooCommerce add_to_cart action

The following works for me for product archive pages (these include both the main shop page as well as archive pages for product categories, for example). It will show the current cart contents in a thickbox. I chose to show this for this example just because that’s the data that one gets back through Ajax … Read more

Plugin not showing in dashboard

If the plugin headers are correct, then the only option that comes to my mind is that the owner and permissions of the plugin file or its directory (if it is in one) are incorrect and WordPress cannot read the plugin file. Other than simply being logically important, if you check the source you can … Read more

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