Skip to content

Instantly share code, notes, and snippets.

View phirebase's full-sized avatar
🌍
Working from home

David Klhufek phirebase

🌍
Working from home
View GitHub Profile
@phirebase
phirebase / phpcs-phpcbf-guide.md
Last active January 26, 2025 13:45
PHPCS and PHPCBF Commands for WordPress

PHPCS and PHPCBF Commands for WordPress

1️⃣ Run PHPCS

Use the phpcs command to analyze your code:

phpcs --standard=WordPress ./path/to/your/file.php

2️⃣ Optional: Automatic Fixes with PHPCBF

@phirebase
phirebase / wp-cli-commands.md
Last active January 8, 2025 23:40
WP-CLI Quick Commands

WP-CLI Quick Commands

A collection of useful WP-CLI commands for managing your WordPress site effectively.

1️⃣ WordPress Core Management

Check WordPress version:

wp core version

Update WordPress:

@phirebase
phirebase / languages-wp-cli-guide.md
Last active January 17, 2025 12:24
How to Initialize and Update `/languages` for a WordPress Plugin using WP-CLI

How to Initialize and Update /languages for a WordPress Plugin using WP-CLI

1️⃣ Create a .pot File

Generate the .pot file to include all translatable strings:

wp i18n make-pot . /languages/my-plugin.pot --domain=my-plugin
  • .: Root directory of your plugin.

Exclude Unit Price for Specific WooCommerce Products

This code snippet overrides the WooCommerce Price Per Unit plugin to exclude unit price for products in the your-category category. It dynamically removes the unit price display for specific products based on their category.

Usage

  1. Copy the code below into your WordPress theme's functions.php file or a custom plugin.
  2. Adjust the $excluded_categories array if needed to match your specific category slugs.