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: WooCommerce Settings Tab Demo | |
* Plugin URI: https://gist.github.com/BFTrick/b5e3afa6f4f83ba2e54a | |
* Description: A plugin demonstrating how to add a WooCommerce settings tab. | |
* Author: Patrick Rauland | |
* Author URI: http://speakinginbytes.com/ | |
* Version: 1.0 | |
* | |
* This program is free software: you can redistribute it and/or modify |
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 // Don't use this line. | |
/* | |
* Add the script below to wherever you store custom code snippets | |
* in your site, whether that's your child theme's functions.php, | |
* a custom plugin file, or through a code snippet plugin. | |
*/ | |
/** | |
* This function will connect wp_mail to your authenticated |
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 | |
/* | |
* Set the following constants in wp-config.php. | |
* These should be added somewhere BEFORE the constant ABSPATH is defined. | |
* | |
* Author: Chad Butler | |
* Author URI: https://butlerblog.com | |
* | |
* For more information and instructions, see: https://b.utler.co/Y3 |
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
import requests | |
import argparse | |
import json | |
my_parser = argparse.ArgumentParser() | |
my_parser.add_argument('-id', '--id', help='ID of the book (https://archive.org/details/XXXX).', type=str) | |
args = my_parser.parse_args() | |
book_id = args.id | |
url = "https://archive.org/details/"+book_id |
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
import img2pdf | |
import argparse | |
import os | |
def process_images(min_range, max_range, img_path, prefix, suffix, out_file): | |
images = [] | |
for i in range(min_range,max_range): | |
fname = img_path + prefix + '%0.3d' % i + '.' + suffix | |
print("adding img: " + fname) | |
images.append(fname) |
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( 'pre_get_posts', array( $this, 'search_metadata' ), 9 ); | |
function search_metadata() { | |
if ( ! is_main_query() || ! is_search() ) { | |
return; | |
} | |
add_filter( 'posts_join', function( $join ) { | |
global $wpdb; |
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 // do not use this line. Add below to functions.php | |
add_action( 'wp_footer', 'list_hooked_filters_and_actions' ); | |
add_action( 'login_footer', 'list_hooked_filters_and_actions' ); | |
add_action( 'admin_footer', 'list_hooked_filters_and_actions' ); | |
function list_hooked_filters_and_actions() { | |
global $wp_filter; |
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 | |
/** | |
* @package Custom_queries | |
* @version 1.0 | |
*/ | |
/* | |
Plugin Name: Custom queries | |
Plugin URI: http://wordpress.org/extend/plugins/# | |
Description: This is an example plugin | |
Author: Carlo Daniele |
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 // no need to use this line. | |
/** | |
* Utility to get information on installed plugins. | |
* | |
* Returns an array of all installed plugins and indicates which are | |
* plugin are active and which are not. Array is keyed by the plugin's | |
* folder/slug.php (which is how WP looks at them) and includes the | |
* name, version, and true/false whether it is active or not. | |
* |
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( 'wpmem_after_admin_init', 'my_add_custom_wpmembers_email' ); | |
function my_add_custom_wpmembers_email() { | |
// Required arguments for wpmem_add_custom_email() | |
$tag = 'my_unique_msg_tag'; | |
$heading = 'Heading to display input in Emails tab'; | |
$subject_input = 'my_unique_subj_tag'; | |
$message_input = 'my_unique_body_tag'; |
NewerOlder