Category Archives: Resources

Woocommerce – remove tabs on the single product page

This snippet allows to quickly remove the tabs area that contains the description, review, attributes and potentially custom tabs. This area is shown by default under the “add to cart” button on the single product page in a WooCommerce shop.

Insert the code in functions.php of your child theme.

add_filter( 'woocommerce_product_tabs', 'remove_tabs_in_single_product', 11 );
 
function remove_tabs_in_single_product( $tabs ) {
	unset( $tabs );
	return $tabs;
}

If you want to remove only the description tab then use this snippet:

add_filter( 'woocommerce_product_tabs', 'remove_description_tab', 12 );
 
function remove_description_tab( $tabs ) {
	unset( $tabs['description'] );
	return $tabs;
}

If you want to remove only the review tab then use this snippet:

add_filter( 'woocommerce_product_tabs', 'remove_review_tab', 13 );
 
function remove_review_tab( $tabs ) {
	unset( $tabs['reviews'] );
	return $tabs;
}

w3 total cache w3tc

File Usage issue caused by WordPress W3 Total Cache

Context

TDLR

  • Website returns Http Error 503 the service is unavailable. Can’t access the WordPress Administration.
  • From CPanel, File Usage reached its hard limit (250,000 files)
  • From File Manager, removed directory “wp-content/cache”
  • File Usage is now way below the threshold
  • Able to access WordPress Administration and configure Total Cache, disabled Database Cache and Object Cache

Explanations

On shared hosting service, it is common to have a limitation on the number of files that can be stored on the hard drive. Even though the Disk Usage is far below the limit (disk 15% full), the File Usage limitation can generate serious issues.

On my hosting provider Zuver, the File Usage soft threshold is 200,000 files which will only give warnings. However, if it hits the 250,000 files hard limit, it will run into issues with the website (Http Error 503 the service is unavailable) and the cPanel account.

Basically, the server separates the entire hard drive into nodes, which are used to store files or parts of files. As you can imagine, a node will be a certain size, and there can only be so many nodes that take up all the space on the hard drive.

Because this is a shared hosting service with more than one user on the server, the number of INodes (files) that can be stored per user must be limited, to avoid hitting the server’s INode limit.

Usually, there is no way to increase the File Usage threshold with the hosting provider. Therefore, an investigation is required.

If WordPress uses W3 Total Cache with Database Cache and Object Cache enabled on disk, chances are that this is causing the issue. Also, you can check the tmp folder and the hidden directories.

The quick fix is to delete the folder /wp-content/cache and then access to the WordPress Administration panel to disable Database Cache and Object Cache.

That’s it.

Port 8080 Already In Use Spring Java Mac

Find out what application uses the port 8080 on Mac

If you develop web applications on your local environment, you will notice that the port 8080 is often set as default. Most likely one day you will face a situation where 2 running web servers want to bind the same port: 8080. Obviously, this is not allowed and you will get an error “Address already in use”. In Java environment, you will get this:

[console]java.net.BindException: Address already in use[/console]

The best way to sort this conflict is to follow these simple steps.

Step 1: find if a process listen on the port 8080

Open a terminal and enter this command:

sudo lsof -i :8080 | grep LISTEN

If you have already a running server on 8080, then the command will show the application running on this port. Note that the second value column is the Process Identification Number which is automatically assigned to each process when it is created on a Unix-like operating system.

[terminal]$ lsof -i :8080 | grep LISTEN
java 28045 nicolas 125u IPv6 0x609c3697d21f8a2d 0t0 TCP *:http-alt (LISTEN)[/terminal]

Step 2: obtain more information about the process

Enter this command in the terminal.

ps -e {pid} | less

Note that you have to replace the {pid} by the value found in the result of the lsof command. In my case scenario, it’s 28045 and it’s Eclipse.

[terminal]$ ps -e 28045 | more -w
PID TTY TIME CMD
28045 ?? 0:13.70 /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bin/java -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=64979 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=localhost -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Djava.security.egd=file:/dev/./urandom -noverify -XX:TieredStopAtLevel=1 -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/resources.jar:{more libraries…}:/Users/nicolas/.m2/repository/org/springframework/spring-jcl/5.1.4.RELEASE/spring-jcl-5.1.4.RELEASE.jar com.nicolasrabier.whatever.ServerApplication –spring.output.ansi.enabled=always
[/terminal]

Step 3: kill the process

If you can no longer quit safely the web server process, there is still a way to kill the process with a command line in the terminal.

Note in the command you have to replace the {pid} by the value found in the result of the lsof command. In my case scenario, it’s still 28045.

sudo kill -9 {pid}

After running this command, no process listens on the port 8080 which means that you can start safely the other web server.

Replace Storefront Footer Credit

In your child theme functions.php file, paste the below:

add_action( 'init', 'remove_storefront_credit', 10 );

function remove_storefront_credit() {
	remove_action('storefront_footer','storefront_credit',20);
	add_action('storefront_footer','my_credit',20);
}

function my_credit() {
	echo '<div class="site-info">';
	echo '© [My Company Name] '.get_the_date('Y');
	echo '</div>';
}

Then replace [My Company Name] by the name of your company or whatever you want.

Photo by KAL VISUALS on Unsplash

Free Software / Tool / Service to run a Small and Medium-sized Business

It can be overwhelming to jump into the endeavour of creating a starting a new business and without knowing if your ideas will work. A critical role is to manage your cash flow and make sure the money is spent wisely. Nowadays, thanks to the internet and the open-source community, there is a plethora of great tools for your business and it won’t cost you any money.

Email Service

First of all, you will need an email address. Create an account on Gmail – https://mail.google.com

This Google account will allow you to access many useful collaborative services such as:

  • Calendar Service: Free Organise meetings & events – https://calendar.google.com
  • Contact Service: Free Directory of your contacts – https://contacts.google.com
  • Google Docs: Free alternative to Microsoft Word. Many users can work simultaneously on the same document. Versioning control. Large choice of templates and different look & feel. – https://docs.google.com
  • Google Sheets: Free alternative to Microsoft Excel. Same as Google Docs, many users can work simultaneously on the same document. Versioning control. And more… – https://docs.google.com/spreadsheets/
  • Google Slides: Free alternative to Microsoft PowerPoint. Same as the other Google tools, many users can work simultaneously on the same document. Versioning control. And more… – https://docs.google.com/presentation
  • Google Drive: Free 15 GB cloud storage space – https://drive.google.com
  • And more…

Operating System

Install the free operating system on to your server to replace Windows or other Linux paid OS: Ubuntu Server

Remote Access

Install Chrome Remote Desktop which is a free remote control software, a good alternative to Teamviewer: How to install Chrome Remote Desktop on Ubuntu 18.04 – (pretty much same config for Ubuntu 16.04)

VPN

How to set up an OpenVPN Server on Ubuntu 16.04

Cloud Printing

Google Cloud Print on Ubuntu 16.04, in 10 minutes!

Dynamic Domain Name Service

How to set up Free DDNS Service on Ubuntu

Backup

How to install and configure ownCloud on Ubuntu 16.06

Usually, I couple ownCloud with a Dropbox account (not free) for redundancy.

ERP / E-commerce website

Install Odoo on an Amazon Lightsail server for $20 / month.

Open Source ERP – Odoo 11 – installation guide on Ubuntu 16.04

Open Source ERP & CRM – Dolibarr (PHP)

Best Wordpress Plugins

[WIP] The Best WordPress Plugins & Themes (No Affiliation)

As a WordPress developer, I thought keeping an organized list of the best and worst plugins. Here is simply my feedback based on my experience with those plugins. This post hasn’t been affiliated by any of the plugin brands.

Here is my Testing Environment for WooCommerce: https://shop.nicolasrabier.com

Color code:

  • ✅ Approved
  • ⚠ Some Warnings
  • ❌ Don’t Waste Your Time

✅ WooCommerce By Automattic

This is a great eCommerce tool. I love it even though it’s far from being perfect.

Pros

  • free
  • works with physical or digital products
  • compatible with many Themes such as StoreFront By WooThemes (same team as Automattic)
  • awesome partnership with Stripe & Paypal plugins
  • you can have a simple shop up and running fairly quickly

Cons

  • require good knowledge of the tool to set it up properly
  • the marketing strategy of Automattic is to use WooCommerce as an entry point to sell the most interesting plugins.
  • You would believe for compatibility reason it is better to use only Automattic plugins but this is not necessary true. e.g.
  • General knowledge in PHP and specifically in WordPress framework can help you a lot and save you money.

✅ Storefront Theme

Pros

  • Front page of the store looks very professional and legit. In order to properly visualize the front page the store needs products and categories in the catalog. Therefore I suggest to import the Dummy Data provided in WooCommerce to have a clear idea of the shop style. Check out this video tutorial that explains how to import the dummy data – https://www.youtube.com/watch?v=LpWZ8jr4Nvw

Cons

  • Many extensions aren’t free

Not sure

  • Compatibility with CDN. When you develop a website for global market you need to make sure the website is quickly reachable from anywhere in the world and nowadays this is achieved via a Content Delivery Network. I personally use CloudFlare coupled with MaxCDN which are integrated via W3TotalCache plugin.

✅ Storefront Sticky Add to Cart By WooThemes 

Love it

✅ Shortcodes Ultimate By Vladimir Anokhin

Best plugin to display information (sliders, box, columns, animations, etc.)

I systematically download it on all my instances of WordPress.

 Child Theme Configurator By Lilaea Media 

Nothing exciting here but it simply makes the creation of a child theme effortless.

Pros

  • Simple and fast

 W3TotalCache By Frederick Townes

This plugin speeds up the loading time of websites from anywhere in the world. This is critical to deliver the best experience to your impatient audience.

Cons

Pros

❌ WooThemes

Cons

  • Poor documentation
  • Support is unreliable
  • Expensive

Note reviews on Theme Grade – http://www.themegrade.com/woothemes-rating/.

 All-In-One WP Migration By ServMask

WooCommerce – Change “Related Products” text

This snippet allows to quickly change the “Related products” text which is shown by default at the bottom of a single product page in a WooCommerce shop.

Check out on my test environment: https://shop.nicolasrabier.com/product/woo-album-4/

Insert the code in functions.php of your child theme.

/**
* Change text strings
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function custom_related_products_text( $translated_text, $text, $domain ) {
  switch ( $translated_text ) {
    case 'Related products' :
      $translated_text = __( 'Other items you might like', 'woocommerce' );
      break;
  }
  return $translated_text;
}
add_filter( 'gettext', 'custom_related_products_text', 20, 3 );

Post context:

  • WordPress
  • WooCommerce

Photo by Fikret tozak on Unsplash

Receive/Send emails in Gmail from external email accounts

If you have multiple email accounts (hotmail, icloud, etc.), you can receive all your emails in one spot, in your Gmail inbox. This document is a step-by-step guide to configure your Gmail as a webmail client.

From a computer

Receive emails from an external email account

  1. Sign in to the Gmail account you want to import to.
  2. In the top right, click Settings Settingsand thenSettings.
  3. Click the Accounts and Import or Accounts tab.
  4. In the “Check mail from other accounts” section, click Add a mail account.
  5. Type the email address of the other account, then click Next Step. (for example: [email protected])
  6. Select “Import emails from my other account (POP3)” then click Next.
  7. Enter username which is often the email address (for example: [email protected])
  8. Type your password.
  9. Enter the POP Server (for example: mail.frenchiesbistroandbrewery.com.au) and port “995“.
  10. Check the boxes next to the options below:
    • “Always use a secure connection (SSL) when retrieving mail”
    • “Label incoming messages”
    • Leave the other boxes unchecked.
  11. Click Add Account.
  12. Select “Yes, I want to be able to send email as {email address}” and hit Next and follow the instructions below from Item #6.

Send emails with an external account

  1. Sign in to the Gmail account you want to configure.
  2. In the top right, click Settings Settingsand thenSettings.
  3. Click the Accounts and Import or Accounts tab.
  4. In the “Send mail as” section, click Add another email address.
  5. Enter the email address (for example: [email protected])
  6. Click on Next Step >>
  7. Set SMTP Server. (for example: mail.frenchiesbistroandbrewery.com.au) and port “465
  8. Enter username which is often the email address (for example: [email protected])
  9. Type your password.
  10. Click on Next.
  11. Then a confirmation code is sent your email address (for example: [email protected]). Copy this code.
  12. Paste the code in the field “Enter and verify the confirmation code” and hit Verify.

Send emails with a default email address

  1. Sign in to the Gmail account you want to configure.
  2. In the top right, click Settings Settingsand thenSettings.
  3. Click the Accounts and Import or Accounts tab.
  4. In the “Send mail as” section, click Make default aligned with your new primary email address.

Compose a new email and send it with another account

  1. Sign in to the Gmail account you want to use.
  2. Click Compose.
  3. In the section “From” of the email, you can choose the sender.

If you have any question, please leave a comment and I will reply as soon as possible.