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 | |
function auto_complete_order( $order_id, $old_status, $new_status ) { | |
$order = wc_get_order( $order_id ); | |
/* | |
* You can get the `your_payment_gateway` identifyer by visiting the WC payments setting page | |
* and selecting the gateway you would like to use. The payment gateway identifyer is the "section=" part of the browser URL | |
*/ | |
if ( $new_status === 'processing' && $order->get_payment_method() === 'your_payment_gateway' ) { | |
$order->update_status( 'completed' ); |
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 | |
/** | |
* Get the average pixel colour from the given file using Image Magick | |
* | |
* @param string $filename | |
* @param bool $as_hex Set to true, the function will return the 6 character HEX value of the colour. | |
* If false, an array will be returned with r, g, b components. | |
*/ | |
function get_average_colour($filename, $as_hex_string = true) { |
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 | |
use PhpCsFixer\Config; | |
use PhpCsFixer\Finder; | |
$rules = [ | |
'array_indentation' => true, | |
'array_syntax' => ['syntax' => 'short'], | |
'binary_operator_spaces' => [ | |
'default' => 'single_space', |
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
<script type="text/javascript"> | |
function idleTimer() { | |
var t; | |
//window.onload = resetTimer; | |
window.onmousemove = resetTimer; // catches mouse movements | |
window.onmousedown = resetTimer; // catches mouse movements | |
window.onclick = resetTimer; // catches mouse clicks | |
window.onscroll = resetTimer; // catches scrolling | |
window.onkeypress = resetTimer; //catches keyboard actions |
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 | |
/** | |
* Generate a sequence of numbers for use in a pagination system, the clever way. | |
* @author Bramus Van Damme <[email protected]> | |
* | |
* The algorithm always returns the same amount of items in the sequence, | |
* indepdendent of the position of the current page. | |
* | |
* Example rows generated: |
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 | |
function themename_custom_logo_setup( $args ) { | |
$args['height'] = 116; | |
$args['width'] = 250; | |
return $args; | |
} | |
add_filter( 'storefront_custom_logo_args', 'themename_custom_logo_setup' ); |
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_filters( 'wp_list_pages_excludes', function( $exclude_array ) { | |
$exclude_array = array( '121' ); | |
return $exclude_array; | |
} | |
); |
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 | |
/** | |
* Filter the content of the new user registration email | |
* @param $message The email content | |
* @param $user The user object | |
* @param $blogname The name of the site | |
* @param $url The url for the user profile | |
*/ | |
function prefix_new_registration_email_content( $message, $user, $blogname, $url ) { | |
$_message = $meessage . '<br>'; |
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: WordPress Export to JSON | |
* Plugin URI: https://jsnelders.com/ | |
* Description: Export all WordPress posts, pages, comments, tags, commments and users to a JSON file. | |
* Author: Jason Snelders | |
* Author URI: http://jsnelders.com | |
* Version: 2020-01-30.1 | |
**/ |
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 | |
function callout_shortcode( $atts ) { | |
$out = ''; | |
$atts = shortcode_atts( | |
array( | |
'callout_h4' => 'This is a header', | |
'callout_p' => 'This is the paragraph below it', | |
), | |
$atts |
NewerOlder