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
add_action( 'phpmailer_init', 'set_phpmailer_details' ); | |
function set_phpmailer_details( $phpmailer ) { | |
$phpmailer->isSMTP(); | |
$phpmailer->Host = 'SMTP_endpoint'; //Amazon SES SMTP endpoint for your region | |
$phpmailer->SMTPAuth = true; | |
$phpmailer->Port = 587; | |
$phpmailer->Username = 'Amazon_SES_USERNAME'; | |
$phpmailer->Password = 'Amazon_SES_PASSWORD'; | |
$phpmailer->SMTPSecure = 'tls'; | |
$phpmailer->From = get_option('admin_email'); //your verified email address |
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
add_filter('manage_posts_columns', 'posts_columns_id', 5); | |
add_action('manage_posts_custom_column', 'posts_custom_id_columns', 5, 2); | |
add_filter('manage_pages_columns', 'posts_columns_id', 5); | |
add_action('manage_pages_custom_column', 'posts_custom_id_columns', 5, 2); | |
function posts_columns_id($defaults){ | |
$defaults['wps_post_id'] = __('ID'); | |
return $defaults; | |
} | |
function posts_custom_id_columns($column_name, $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
<?php | |
/* | |
Plugin Name: NeatSnippet | |
Description: Show at plugin description | You can have even <a href="example.com">a link</a> here | |
*/ | |
/* Start Adding Functions Below this Line */ | |
/* Stop Adding Functions Below this Line */ | |
?> |
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
// Podcast to wp-category | |
add_action( 'init', 'ssp_add_categories_to_podcast' ); | |
function ssp_add_categories_to_podcast () { | |
register_taxonomy_for_object_type( 'category', 'podcast' ); | |
} | |
add_action( 'pre_get_posts', 'ssp_add_podcast_to_category_archives' ); | |
function ssp_add_podcast_to_category_archives( $query ){ | |
if( is_admin() ) { |
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
function custom_pre_get_posts($query) { | |
// validate | |
if(!is_admin() && $query->is_main_query()) { | |
if(is_archive()) { | |
$query->set('orderby', 'title'); // order posts by title | |
$query->set('order', 'ASC'); // and in ascending order | |
} | |
} | |
} |
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
// Add WooCommerce customer username to edit/view order admin page | |
add_action( 'woocommerce_admin_order_data_after_billing_address', 'woo_display_order_username', 10, 1 ); | |
function woo_display_order_username( $order ){ | |
global $post; | |
$customer_user = get_post_meta( $post->ID, '_customer_user', true ); | |
echo '<p><strong style="display: block;">'.__('Customer Username').':</strong> <a href="user-edit.php?user_id=' . $customer_user . '">' . get_user_meta( $customer_user, 'nickname', true ) . '</a></p>'; | |
} |
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
function eksis_remove_wc_currency_symbol( $currency_symbol, $currency ) { | |
if (!is_cart()){ | |
$currency_symbol = ''; | |
return $currency_symbol; | |
} | |
} | |
add_filter('woocommerce_currency_symbol', 'eksis_remove_wc_currency_symbol', 10, 2); |
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
add_filter( 'upload_mimes', 'my_mime_types', 1, 1 ); | |
function my_mime_types( $mime_types ) { | |
$mime_types['jpg|jpeg|jpe'] = 'image/jpeg'; | |
$mime_types['gif'] = 'image/gif'; | |
$mime_types['png'] = 'image/png'; | |
$mime_types['bmp'] = 'image/bmp'; | |
$mime_types['tiff|tif'] = 'image/tiff'; | |
$mime_types['ico'] = 'image/x-icon'; | |
$mime_types['asf|asx'] = 'video/x-ms-asf'; |
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
wget --spider -o wget.log -e robots=off -r -l 5 -p -S -T3 --header="X-Bypass-Cache: 1" -H --domains=example.tld --show-progress www.example.tld | |
# Options explained | |
# --spider: Crawl the site | |
# -o wget.log: Keep the log | |
# -e robots=off: Ignore robots.txt | |
# -r: specify recursive download | |
# -l 5: Depth to search. I.e 1 means 'crawl the homepages'. 2 means 'crawl the homepage and all pages it links to'... | |
# -p: get all images, etc. needed to display HTML page | |
# -S: print server response (to the log) |
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
map_hash_bucket_size 256; | |
map $request_uri $new_uri { | |
include /etc/nginx/snippets/includes/301.example.tld.map; | |
} | |
server { | |
listen <ip-address>:443 ssl http2; | |
server_name example.tld www.example.tld; |