Author: Rubel
I’m Rubel Miah. I love my work and enjoys creating stunning WordPress Themes. I’m a WordPress fanatic & started career with WordPress Theming & still on it. When I remain free I do photo shooting & write blog.

How to setup WPCS with Visual Studio Code on Mac

Step 1. Install Composer

Download composer binary file from getcomposer.org website by running the following command. It will create a composer.phar file in the current directory.

curl -sS https://getcomposer.org/installer | php

Now, copy this composer.phar file under bin directory to make available anywhere in the system. Also, set the execute permission on file. I have changed the filename from composer.phar to composer for the easy use.

sudo mv composer.phar /usr/local/bin/composer
chmod +x /usr/local/bin/composer

Run composer command on the command prompt. This will provide you composer version details along with options available with composer command.

composer

Upgrade PHP Composer

The PHP composer provides a command-line option (self-update) to upgrade itself. You can simply run below command from the terminal to upgrade compose on your macOS.

sudo composer self-update

How to Customizing iterm2 with ZSH and Powerline Fonts

  1. Download iTerm2 and install it.
  2. Install ZSH with terminal, ex: sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
  3. Download Cobalt2 and drop the cobalt2.zsh-theme file in to the open ~/.oh-my-zsh/themes/ directory.
  4. Open up your ZSH preferences at open ~/.zshrc and change the theme variable to ZSH_THEME=cobalt2.
  5. Install Powerline and necessary fonts, one way is using PIP.

For first time PIP users you need to install PIP sudo easy_install pip

To install Powerline using pip

pip install --user powerline-status

Now install all necessary fonts by downloading or cloning git repository.

git clone https://github.com/powerline/fonts
cd fonts
./install.sh
  1. In iTerm2 access the Preferences pane on the Profiles tab.
  2. Under the Colors tab import the cobalt2.itermcolors file via the Load Presets drop-down.
  3. Under the Text tab change the font for each type (Regular and Non-ASCII) to ‘Inconsolata for Powerline‘. (Refer to the powerline-fonts repo for help on font installation.)
  4. Refresh ZSH by typing source ~/.zshrc on the command line.

How to Add The Total Active installations For Plugins Attached to a WordPress.org Username

function sp_total_active( $username = false, $args = array() ) {
	if ( $username ) {
		$params = array(
			'timeout'   => 10,
			'sslverify' => false
		);

		$raw = wp_remote_retrieve_body( wp_remote_get( 'http://wptally.com/api/' . $username, $params ) );
		$raw = json_decode( $raw, true );

		if ( array_key_exists( 'error', $raw ) ) {
			$data = array(
				'error' => $raw['error']
			);
		} else {
			$data = $raw;
		}
	} else {
		$data = array(
			'error' => __( 'No data found!', 'shapedplugin' )
		);
	}

	return apply_filters( 'sp_total_active', $data );
}

$total_active = sp_total_active('shapedplugin');


$plugin_names = array_values( $total_active['plugins'] );

$install = 0;
foreach ($plugin_names as &$plugin_name) {
    $install += $plugin_name['installs'];
    
}
echo esc_html($install);

 

How to Fix Missing ‘System Settings’ or ‘Settings’ in Ubuntu 20.04 LTS

Step 1: Right Click on the Desktop and Click ‘Open terminal‘.

You can also open Terminal by pressing Alt+Ctrl+t key on the keyboard.

Step 2: To install System Settings, type the command below in terminal:-

sudo apt install gnome-control-center

if it asks for your permission, press ‘Y’ key on the keyboard.

Step 3: To open the system settings, you can click on show Applications at the bottom left of your ubuntu and Type ‘settings’ in search box.

It’s Done

How to Remove/Hide Featured Image From WooCommerce Gallery

Use this code in functions.php file.

/**
 * Exclude the featured image from appearing in the product gallery, if there's a product gallery.
 *
 * @param array $html Array of html to output for the product gallery.
 * @param array $attachment_id ID of each image variables.
 */
function rm_woocommerce_remove_featured_image( $html, $attachment_id ) {

	global $post, $product;

	// Get the IDs.
	$attachment_ids = $product->get_gallery_image_ids();

	// If there are none, go ahead and return early - with the featured image included in the gallery.
	if ( ! $attachment_ids ) {
		return $html;
	}

	// Look for the featured image.
	$featured_image = get_post_thumbnail_id( $post->ID );

	// If there is one, exclude it from the gallery.
	if ( is_product() && $attachment_id === $featured_image ) {
		$html = '';
	}

	return $html;
}
add_filter( 'woocommerce_single_product_image_thumbnail_html', 'rm_woocommerce_remove_featured_image', 10, 2 );