Category Archive for: Development

#!BIN/BASH

Sourced Bash Variables Not Working in Conditional Statements

The other day I was writing a bash script to make automatic backups of MongoDB. I had the main backup script (backup.sh) and an options file (options.cfg). The idea was that backup.sh would be committed to the project’s repository, while options.sh would be a local file, not added to the repo, because it might contain…

Read More →

Git Logo

Make Shell Script Committed to Git Executable

You wrote a shell script (script.sh), say for a database backup or to regularly remove old files, and committed and pushed it to your Git repository. You go to your server, do git pull to pull the latest commit and try to execute the script with ./script.sh. Uh, oh, Permission denied, the script won’t run.…

Read More →

Nginx

Nginx Ignoring Server Blocks (Virtual Hosts) in Sites-Enabled

I’ve been setting up a web server for my latest project – a Node.js / Express app. All was going well – I spun up a droplet on DigitalOcean, installed NVM, Node, Git, MongoDB and deployed and configured my app. Then I decided to add Nginx into the stack to act as a reverse proxy…

Read More →

WooCommerce Logo

Display WooCommerce Product Category Description on All Category Pages

Out of the box, WooCommerce displays the product category description only on the first page of the category archive. In other words, if the category contains a bunch of products and is paginated, the category description will not be shown on page 2, 3, etc. But what if you want to display the category description…

Read More →

WordPress Logo

Pre-Load WordPress Audio Metadata Automatically

Out of the box, WordPress does not pre-load metadata or the tracks themselves when you embed an audio file in your post or page. Funny enough it does it for video embeds, but for audio files the preload attribute is set to ‘none’ by default. I am presuming they made the decision in order to…

Read More →

WordPress Logo

Style the First Word of WordPress Category Titles

One of my latest WordPress projects required a differently styled first word of category titles (as they appear on the frontend of the site). While there are CSS rules that can be used to style the first letter of a word or the first line of a paragraph, there unfortunately is not an equivalent to…

Read More →

Add a CMS Block on Magento’s Cart Page

One of my client’s is running a special promotion in their Magento store and they want to add banner on the shopping cart page with the details of the promotion and to remind the customers to take advantage of it. Specifically, they want to put the banner just above the shopping cart contents table as…

Read More →

WooCommerce Logo

Remove WooCommerce Product Sorting Options

Here’s another WooCommerce trick to add to your arsenal. When you browse a product category in a WooCommerce powered store, you can sort the products. Depending on your theme, the sorting options may be displayed in a dropdown menu, as a row of buttons/links, etc. Usually the options include ‘default’ sorting, sorting by ‘popularity, ‘rating’,…

Read More →

WooCommerce Logo

Shorten WooCommerce Product Titles

WooCommerce is a free and the most popular e-commerce solution for WordPress. It is packed with features and has everything you need to run a small to mid size online shop. It is not as powerful or customizable as Magento, but it is incomparably easier to set up, host and manage. It is under active…

Read More →

Ubuntu in the Cloud

How to Fix Invalid Locale Setting in Ubuntu 14.04 in the Cloud

If you use Ubuntu in the cloud, specifically in AWS, you may see this warning message after SSHing into your server: WARNING! Your environment specifies an invalid locale. This can affect your user experience significantly, including the ability to manage packages. If you than try to install any new packages with apt-get or even restart/reload…

Read More →