How to implement color picker from wordpress in my plugin?

Yes, there is: https://make.wordpress.org/core/2012/11/30/new-color-picker-in-wp-3-5/ 1. You should enqueue scripts and styles… add_action( ‘admin_enqueue_scripts’, ‘mw_enqueue_color_picker’ ); function mw_enqueue_color_picker( $hook_suffix ) { // first check that $hook_suffix is appropriate for your admin page wp_enqueue_style( ‘wp-color-picker’ ); wp_enqueue_script( ‘my-script-handle’, plugins_url(‘my-script.js’, __FILE__ ), array( ‘wp-color-picker’ ), false, true ); } 2. … add an input… <input type=”text” value=”#bada55″ class=”my-color-field” … Read more

Remove profile picture option (and other things) from profile.php (in admin)

We can use the show_avatars option to remove the Profile Picture section. We can visit /wp-admin/options.php to turn it off manually. Or update it with: update_option( ‘show_avatars’, 0 ); Or modify it through a filter: add_filter( ‘option_show_avatars’, ‘__return_false’ ); We could also restrict it to the profile.php page: add_action( ‘load-profile.php’, function() { add_filter( ‘option_show_avatars’, ‘__return_false’ … Read more

$wpdb->insert_id

There is no other way, but I can not see how you need any other way then this. I believe that the insert ID accessed by $wpdb is the last ID by this instance of WPDB, other inserts should not affect that but I’m not sure. <?php $wpdb->insert(“QUERY”); $this_insert = $wpdb->insert_id; ?>

What is the correct way to build a widget using OOP

You can simply put your init code within the constructor of the class. For example: class myWidget extends WP_Widget{ function myWidget(){ // Init code here } function widget( $args, $instance ) { // The widget code wp_enqueue_script(…); wp_enqueue_style(…); } // Over methods… } register_widget(‘myWidget’); My preference is to actually put the enqueue calls within the … Read more

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