Skip to content

Instantly share code, notes, and snippets.

@pkboy
pkboy / oxygen-svg-fix-snippet.php
Last active June 27, 2023 12:25
Run Once Code Snippet to fix missing Oxygen SVG XML
// code snippets version of fix for bug reported here:
// https://github.com/soflyy/oxygen-bugs-and-features/issues/2820
// add this snippet to some code snippet plugin and run it once. If using
// Code Snippets, select "Only Run Once" then "Save and Activate".
// This should restore the XML that were erased or corrupted.
// Tested on a sandbox instance. Replicated bug on a sandbox instance.
// Started sandbox, Oxygen loads, saved options.php, Oxygen crashes.
<?php
/*** Add a custom favicon for the admin area ***/
function custom_admin_favicon() {
$url = ''; // Place the path to your dashboard icon here.
echo '<link rel="Shortcut Icon" type="image/x-icon" href="' . $url . '" />';
}
add_action( 'admin_head', 'custom_admin_favicon' );
/*** Add a custom default front end favicon ***/
@yankiara
yankiara / oxygen-repeater-dynamic-query.php
Last active July 15, 2024 15:17
Use dynamic queries with Oxygen's repeater
/* I'll put here different examples of dynamic query for Oxygen repeater :
* - Use one of the following repeater_dynamic_query definitions
* in code block just BEFORE the repeater
* - Set the repeater custom query settings : post type, number of posts, order...
* - Add the remove_action in a code block AFTER the repeater
*/
/****************************************************************************************************
* Display related posts for any CPT with taxonomy:
@corsonr
corsonr / available_fields.php
Last active October 4, 2022 11:24
WooCommerce Stripe: add custom meta data to send to stripe
<?php
$order->get_data(); (not needed is using the code above)
$order_id = $order_data['id'];
$order_parent_id = $order_data['parent_id'];
$order_status = $order_data['status'];
$order_currency = $order_data['currency'];
$order_version = $order_data['version'];
$order_payment_method = $order_data['payment_method'];
$order_payment_method_title = $order_data['payment_method_title'];
@slushman
slushman / wp_auto_install.sh
Last active December 14, 2018 03:11 — forked from nicomollet/wp_auto_install.sh
WP-CLI auto install local development site script
#!/bin/bash
# Get the required project variables
printf "Project name: "
read PROJECT_NAME
printf "Project folder name: "
read PROJECT_FOLDER
printf "Database Name: "
add_action( 'woocommerce_thankyou', 'ad_redirectcustom');
function ad_redirectcustom( $order_id ){
$order = new WC_Order( $order_id );
$items = $order->get_items();
$product_id=223074;//id of your product
$product_id2=223076;// id of your product
$url ='';// url for the redirection after purchase your product
$url2='';
foreach ( $items as $item ) {
@carlodaniele
carlodaniele / media-hacks.php
Last active March 28, 2024 20:19
An example WP plugin which adds functionalities to the WordPress Media Library
<?php
/**
* @package Media_hacks
* @version 1.0
*/
/*
Plugin Name: Media hacks
Plugin URI: http://wordpress.org/extend/plugins/#
Description: This is an example plugin
Author: Carlo Daniele
@spivurno
spivurno / gw-gravity-forms-advanced-conditional-logic.php
Last active June 5, 2024 15:38
Gravity Wiz // Gravity Forms // Advanced Conditional Logic
<?php
/**
* Gravity Wiz // Gravity Forms // Advanced Conditional Logic
*
* PLEASE NOTE: This snippet is a proof-of-concept. It is not supported and we have no plans to improve it.
*
* Allows multiple groups of conditional logic per field.
*
* @version 0.1
* @author David Smith <david@gravitywiz.com>
@loop
loop / pagesToPDF.applescript
Created October 15, 2015 19:33
convert pages to pdf applescript
set theFolder to choose folder with prompt "Select folder with original pages files :"
--Do it
tell application "Finder"
set theNames to name of files of theFolder ¬
whose name extension is "pages"
end tell
-- How many files to export
set item_count to (get count of items in theNames)
@lastguest
lastguest / append_on_copy.js
Created May 20, 2015 13:25
[JavaScript] Append text on clipboard copy from a page.
document.addEventListener('copy', function() {
//Get the selected text and append the extra info
var selection = window.getSelection(),
pagelink = '<br /><br /> Read more at: ' + document.location.href,
copytext = selection + pagelink,
newdiv = document.createElement('div');
//hide the newly created container
newdiv.style.position = 'absolute';
newdiv.style.left = '-99999px';