Adding WordPress ColorPicker in Widget


Widget color picker code.

Git Commands

Creating tags from the command line:

To create a tag on your current branch, run this:

If you want to include a description with your tag, add -a to create an annotated tag:

This will create a local tag with the current state of the branch you are on. When pushing to your remote repo, tags are NOT included by default. You will need to explicitly say that you want to push your tags to your remote repo:

From the official Linux Kernel Git documentation for git push:

All refs under refs/tags are pushed, in addition to refspecs explicitly listed on the command line.

Or if you just want to push a single tag:

See also my answer to How to push a tag to a remote repository using Git? for more details about that syntax above.

Add custom field to WooCommerce product category


How to import database in MySQL using terminal

For large and very large SQL file, the best approach is to login your server via SSH and directly import it in the database by this command line after uploading the SQL file in /root via FTP:

mysql -u <username> -p <databasename> < <filename.sql>

And enter the password when it prompts you. It will then start importing wordpress.sql into the databasename database.

How to modified wp_trim_words to include html tags