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 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 );


How to setup WPCS with Visual Studio Code

Step 1: Install PHP
Composer requires PHP 5.3 or higher… to install PHP (7.2) on Ubuntu, run the commands below

sudo apt install php7.2

Step 2: Install Composer

Now that PHP is installed… you can now run the commands below to install Composer

Continue Reading

How to create .gitignore file

The .gitignore file is not added to a repository by default. Use terminal touch .gitignore or your favorite text editor to create the .gitignore file then issue a git add .gitignore followed by git commit -m "message" .gitignore. The following commands will take care of it.

touch .gitignore
nano .gitignore
git add .gitignore
git commit -m "message" .gitignore

Code from

.gitignore file generator or generated code

Adding WordPress ColorPicker in Widget


<script type="text/javascript">

    ( function( $ ){
        function initColorPicker( widget ) {
            widget.find( '.color-picker' ).not('[id*="__i__"]').wpColorPicker( {
                change: _.throttle( function() {
                    $(this).trigger( 'change' );
                }, 3000 )

        function onFormUpdate( event, widget ) {
            initColorPicker( widget );

        $( document ).on( 'widget-added widget-updated', onFormUpdate );

        $( document ).ready( function() {
            $( '.widget-inside:has(.color-picker)' ).each( function () {
                initColorPicker( $( this ) );
            } );
        } );

    }( jQuery ) );


Widget color picker code.

    <label for="<?php echo esc_attr( $this->get_field_id( 'rm_background' ) ); ?>"><?php _e
        ( 'Background', 'text-domain'   ); ?></label>
    <input id="<?php echo esc_attr( $this->get_field_id( 'rm_background' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'rm_background' ) ); ?>" value="<?php echo $instance['rm_background']; ?>" class="wp-color-result"/>

Git Commands

Creating tags from the command line:

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

git tag <tagname>

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

git tag <tagname> -a

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:

git push origin --tags

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:

git push origin <tag>

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