Free
Display Breadcrumbs without Plugin in WordPress
Add custom class to WordPress excerpt
Archive with numbered pagination – loop posts
template-parts/content-archive.php
SASS
Add hreflang markup to head section of WordPress Multisite
Let’s set up hreflang language markup in HTML for all language versions
Add hreflang to the HTML of each page that you want to specify alternative versions. The tag should be added at the beginning of the head section after Title and Description.
Variable hreflang x-default
- If there is a language selection page, a line of code should be added to it with the hreflang attribute and a “default” value.
- The x-default value of the hreflang attribute tells you that this page has no specific language, regional settings or it is an IP-dependent page, in other words, it is the default page.
- If there is no specific language version for a user, the default page will be shown to him.
echo '<link rel="alternate" hreflang="x-default" href="https://YOURWEBSITE.com" />';
Conversion Tracking for WooCommerce
Google Ads Global tag
Event snippet for conversion page
Display Product Price with VAT in Single Product WooCommerce
WordPress asking for my FTP credentials to install plugins
sudo chown -R www-data:www-data PATH_TO_YOUR_WORDPRESS_FOLDER
Check if multiple categories is in the cart
Disable Specific Shipping Method based on Category
Check if specific category is in the cart
Disable Weekends and Previous Dates in DatePicker
Change Continue Shopping link to the Previously Visited Page in WooCommerce
This snippet changes the redirect URL for the Return To Shop button in the cart
Shorten the post title in WordPress
How to display Categories and Products in Separate Lists in WooCommerce
How to install the `ll` command on Mac OS X?
If You want to list directory contents in terminal, you need to type the following command:
ls -la
But it’s easier to simplify this command in MacOS:
alias ll='ls -lG'
Now just go ahead and type:
ll
How to fix WP-CLI Error establishing database connection in LocalWP
Create file named info.php in your WordPress root folder with the following PHP function:
<?php phpinfo(); ?>
Check the http://yourdomain.com/info.php details and search for pdo_mysql.default_socket. Here You will find the value that You need>
Change your DB_HOST value in the wp-config.php file from localhost to
/** MySQL hostname */ define( 'DB_HOST', 'localhost:/Users/YOUR_MACOS_USERNAME/Library/Application Support/Local/run/VALUE_FROM_PHP_INI/mysql/mysqld.sock'
YOUR_MACOS_USERNAME – whatever your username that you log into your computer with.
VALUE_FROM_PHP_INI – Click the (i) icon next to the version of PHP in Local. Once the php info page loads in your browser, search the page for “Loaded Configuration File”. You should see something like /Users/xxx/Library/Application Support/Local/run/JVTSp1q91/conf/php/php.ini. Grab the random set of characters between “run/” and “/conf”. In my example, JVTSp1q91.
Compile SASS and build JS with Webpack
If You’ve tried SASS before You don’t want to write a single line of CSS anymore. Webpack is an awesome tool that builds and minify the JavaScipt and CSS files.
How to use Webpack with SASS Loader?
Open the terminal at the project folder
Step 1 – Initialize package.json
npm init -y
Step 2 – Install the following packages:
- Webpack
- Webpack-CLI
- Sass Loader
- Node Sass
npm install --save-dev webpack webpack-cli sass-loader node-sass
Your package.json going to be look like this
It is going to be generated, so You don’t need to copy the content.
Step 3 – Create a file named webpack.config.js
Step 4 – Run webpack and watch for changes
npx webpack --watch
Webpack basic config
webpack.config.js