Git Flow Command

To list/start/finish feature branches, use:

git flow feature
git flow feature start [name] [base]
git flow feature finish [name]

To push/pull a feature branch to the remote repository, use:

git flow feature publish [name]
git flow feature pull [remote] [name]

To list/start/finish release branches, use:

git flow release
git flow release start [release] [base]
git flow release finish [release]

To list/start/finish hotfix branches, use:

git flow hotfix
git flow hotfix start [release] []
git flow hotfix finish [release]

To list/start support branches, use:

git flow support
git flow support start [release] [base]


Git change remote URL

git remote -v
# View existing remotes

# origin (fetch)
# origin (push)

git remote set-url origin
# Change the 'origin' remote's URL

git remote -v
# Verify new remote URL

# origin (fetch)
# origin (push)

PHP command line syntax checking

Thanks to this bro for the post that help me find the syntax error inside my bunch of php code (

Syntax checking a single PHP file from the command line

The syntax for checking is like this, where the -l flag is a lower case L:
php -l filename

Syntax check all PHP files in the current directory

for i in *.php; do php -l $i; done

Syntax check all PHP files in the current directory and all subdirectories

find . -name \*.php -exec php -l "{}" \;

Add Currency to Woocommerce

Add this code to your functions.php file:

function add_my_currency( $currencies ) {
$currencies["IDR"] = 'Rupiah';
return $currencies;
add_filter( 'woocommerce_currencies', 'add_my_currency', 10, 1 );

Add Watermark to Textbox using jQuery

jQuery(document).ready(function() {
var watermark = "Type the code seen above";
jQuery(".wpcf7-captchar").focus(function() {
if (jQuery.trim(jQuery(".wpcf7-captchar").val()) == watermark) {
jQuery(".wpcf7-captchar").blur(function() {
if (jQuery.trim(jQuery(".wpcf7-captchar").val()) == "") {

Contact Form 7 watermark for select menu

Put this code in your functions.php file:

function my_wpcf7_form_elements($html) {
$text = 'Please select...';
$html = str_replace('---', '' . $text . '', $html);
return $html;
add_filter('wpcf7_form_elements', 'my_wpcf7_form_elements');

Add User to SQL Server Database

Add User Using Windows Authentication

-- Create user windows Authentication
-- Now add user to database
USE YourDatabaseHere;
CREATE USER JohnJacobs FOR LOGIN [YourDomainNameJohnJacobs];
-- If adding to a second database, do so below:
USE YourSecondDatabaseHere;
CREATE USER JohnJacobs FOR LOGIN [YourDomainNameJohnJacobs];

Add User Using SQL Authentication

-- Create user for SQL Authentication
CREATE LOGIN JohnJacobs WITH PASSWORD = 'JinGleHeimerSchmidt'
,DEFAULT_DATABASE = [YourDatabaseHere]
-- Now add user to database
USE YourDatabaseHere;
CREATE USER JohnJacobs FOR LOGIN JohnJacobs;
-- If adding to a second database, do so below:
USE YourSecondDatabaseHere;
CREATE USER JohnJacobs FOR LOGIN JohnJacobs;

Retina Display Media Query

For including high-res graphics, but only for screens that can make us of them. “Retina” being “2x”:

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) { /* Retina-specific stuff here */ }

Add “first” and “last” CSS classes to dynamic sidebar widgets.

* Add "first" and "last" CSS classes to dynamic sidebar widgets. Also adds numeric index class for each widget (widget-1, widget-2, etc.)
function widget_first_last_classes($params) {

global $my_widget_num; // Global a counter array
$this_id = $params[0][‘id’]; // Get the id for the current sidebar we’re processing
$arr_registered_widgets = wp_get_sidebars_widgets(); // Get an array of ALL registered widgets

if(!$my_widget_num) {// If the counter array doesn’t exist, create it
$my_widget_num = array();

if(!isset($arr_registered_widgets[$this_id]) || !is_array($arr_registered_widgets[$this_id])) { // Check if the current sidebar has no widgets
return $params; // No widgets in this sidebar… bail early.

if(isset($my_widget_num[$this_id])) { // See if the counter array has an entry for this sidebar
$my_widget_num[$this_id] ++;
} else { // If not, create it starting with 1
$my_widget_num[$this_id] = 1;

$class = ‘class=”widget-‘ . $my_widget_num[$this_id] . ‘ ‘; // Add a widget number class for additional styling options

if($my_widget_num[$this_id] == 1) { // If this is the first widget
$class .= ‘widget-first ‘;
} elseif($my_widget_num[$this_id] == count($arr_registered_widgets[$this_id])) { // If this is the last widget
$class .= ‘widget-last ‘;

$params[0][‘before_widget’] = preg_replace(‘/class=\”/’, “$class”, $params[0][‘before_widget’], 1);

return $params;