This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Quick Post Widget | |
Description: Adds a Quick Post widget that creates and publishes posts with hashtags converted to tags. | |
*/ | |
// Add the Quick Post widget to the dashboard | |
function qpw_add_dashboard_widgets() { | |
wp_add_dashboard_widget('qpw_widget', 'Quick Post', 'qpw_widget_display'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('after_switch_theme', function(){ | |
// Set a flag indicating a new installation | |
set_theme_mod('theme_version', '1.2.3'); | |
}); | |
// Upgrade routine for backwards compatibility with pre-existing home screen setup. | |
add_action('init', function() { | |
// Check if the update logic has already been executed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require( 'fs' ) | |
const themeJson = fs.readFileSync( './theme.json' ) | |
const theme = JSON.parse( themeJson ) | |
const colors = theme.settings.color.palette.reduce( ( acc, item ) => { | |
const [color, number] = item.slug.split( '-' ) | |
// If there is a number identifier, make this an object | |
if(undefined !== number) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Affiliate Order Detail Notes | |
* Text Domain: affwp_od | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Hash_Generator { | |
/** | |
* The generated hash. | |
* | |
* @var string | |
*/ | |
private $hash = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Adds a section showing the total sales earned by the affiliate to the AffiliateWP affiliate area's statistics tab. | |
*/ | |
add_action( 'affwp_affiliate_dashboard_after_earnings', function( $affiliate_id ) { | |
// You can add or remove statuses here. Any status shown in this array will be included in the calculation. | |
// Supported statuses are paid, unpaid, pending, and rejected. | |
$statuses = [ 'paid', 'unpaid', 'pending', ]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body:not(.gutenberg-editor-page) { | |
background-color: #111111; | |
color: #bbc8d4 | |
} | |
body:not(.gutenberg-editor-page) #wpbody, | |
body:not(.gutenberg-editor-page) #wpfooter { | |
background-color: #111111; | |
color: #bbc8d4 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){ const outline = document.querySelector('.outline-everything-with-red'); if(!outline){ style = document.createElement('style'); style.classList.add('outline-everything-with-red'); style.appendChild(document.createTextNode('* {outline: 1px solid red;}')); document.head.appendChild(style); console.log('The following elements appear to be wider than the document.'); [].forEach.call( document.querySelectorAll('*'), function(el) { if (el.offsetWidth > docWidth) { console.log(el); } } ); } else{ outline.remove(); } var docWidth = document.documentElement.offsetWidth; })() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Manipulate referral that was just created for the specified order ID | |
// This example is WooCommerce-specific. The action used is based on whatever action is used to run 'get_pending_referral' in your integration class. | |
// Integration class is located in includes/integrations/ | |
add_action( 'woocommerce_checkout_update_order_meta',function( $order_id ){ | |
$referral = affilite_wp()->referrals->get_by('reference',$order_id); | |
if( $referral ){ | |
// Change referral based on params here. | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('affwp_referral_type_init',function( $registry ){ | |
$registry->register_type( 'custom_type', array( | |
'label' => __( 'Custom Type', 'text-domain' ), | |
) ); | |
} |
NewerOlder