Skip to content

Instantly share code, notes, and snippets.

@swashata
swashata / .gitlab-ci.yml
Created July 4, 2020 14:29
Deploy WordPress Plugin with GitLab CI/CD
# Our base image
image: registry.gitlab.com/wpquark/docker-containers/php-node:2.0.0-php-7.3-node-12.13.0
# Select what we should cache
cache:
key: "$CI_COMMIT_REF_SLUG-$CI_JOB_NAME"
paths:
- .yarn-cache
- .composer-cache
@phpbits
phpbits / editorskit.php
Created August 2, 2019 12:15
Using EditorsKit Utility Classes Filter
<?php
/**
* Add Support for EditorsKit Plugin
*
* @package Jarvis
* @subpackage EditorsKit
* @author Jeffrey Carandang <jeffreycarandang.com>
* @link https://editorskit.com/
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License
*/
@bekarice
bekarice / user-switching-notice-for-wc.php
Created February 12, 2019 01:40
Uses the "demo store" notice to show a switch back link for WC customer accounts with User Switching: http://cloud.skyver.ge/c50cbcd4c5e7
<?php
/**
* Plugin Name: User Switching Notice for WooCommerce
* Plugin URI: https://gist.github.com/bekarice/7785293fb60d7d5297a245b1c1271272
* Description: Adds a frontend notice to switch back to your user on WooCommerce sites with User Switching.
* Author: SkyVerge
* Author URI: http://www.skyverge.com/
* Version: 1.0.0
* Text Domain: user-switching-notice-for-woocommerce
*
@eduardoarandah
eduardoarandah / add_contact_form_7_custom_tag.php
Created December 13, 2018 03:22
Adding A Custom Form-Tag to Contact Form 7 in Wordpress
<?php
/**
* Contact form 7
* custom tag: [posts show:12]
* show parameter is optional
*/
add_action('wpcf7_init', 'custom_add_form_tag_posts');
function custom_add_form_tag_posts()
{
@mikejolley
mikejolley / functions.php
Last active November 8, 2022 00:25
WooCommerce 3.3 - Hide uncategorized category from the shop page on the frontend
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
add_filter( 'woocommerce_product_subcategories_args', 'custom_woocommerce_product_subcategories_args' );
function custom_woocommerce_product_subcategories_args( $args ) {
$args['exclude'] = get_option( 'default_product_cat' );
return $args;
@mattradford
mattradford / exodus-list
Created January 2, 2018 21:04 — forked from anonymous/exodus-list
Trackers from https://reports.exodus-privacy.eu.org/trackers/ for use in DNS blocking
# List of trackers for DNS blocking
# Taken from https://reports.exodus-privacy.eu.org/trackers/ and https://discourse.pi-hole.net/t/trackers/5656
0.0.0.0 a4.tl2
0.0.0.0 accengage.com
0.0.0.0 aatkit.com
0.0.0.0 adswizz.com
0.0.0.0 appboy.com
0.0.0.0 adnxs.com
0.0.0.0 appsflyer.com
@lukecav
lukecav / functions.php
Created December 29, 2017 16:38
Get All orders IDs for a given product ID in WooCommerce
/**
* Get All orders IDs for a given product ID.
*
* @param integer $product_id (required)
* @param array $order_status (optional) Default is 'wc-completed'
*
* @return array
*/
function get_orders_ids_by_product_id( $product_id, $order_status = array( 'wc-completed' ) ){
global $wpdb;
@yratof
yratof / class-craft-images.php
Last active February 15, 2018 13:51
Call the featured image with an SVG fallback for featured image
<?php
class drivkraft_load {
/**
* Output featured image with SVG placeholder
* @return html
*/
static function featured_image( $post_id = null, $size = 'medium', $colour = '#f3f3f3' ) {
global $post;
@cyberwani
cyberwani / custom-menu-items.php
Last active November 30, 2017 12:08 — forked from daggerhart/custom-menu-items.php
WordPress class for easily adding custom menu items dynamically to a menu.
<?php
class custom_menu_items {
// only register with wp hooks once
protected $has_registered = false;
// internal list of menus affected
public $menus = array();
// internal list of new menu items
public $menu_items = array();
@petermuller71
petermuller71 / cryptor.php
Last active July 23, 2023 16:41
cryptor : PHP Encryption and decryption based on libsodium (standard lib >php7.2)
<?php
print "<h1>PHP Encryption with libsodium</h1>";
$message = "This text is secret";
$ciphertext = cryptor::encrypt("password", $message);
$plaintext = cryptor::decrypt("password", $ciphertext);
print "Message:<br />$message <br /><br />Ciphertext:<br />$ciphertext<br /><br />Plaintext:<br />$plaintext";