Skip to content

Instantly share code, notes, and snippets.

Avatar

taricco

  • Seattle, WA
View GitHub Profile
View HTACCESS.txt
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Header always set Content-Security-Policy "upgrade-insecure-requests;"
# START WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
View MatchHeight Plugin Classes.txt
/* https://wordpress.org/plugins/matchheight/ */
Columns: .wsv-match-height .fl-col-content
PowerPack Info Box: .wsv-match-height .pp-infobox
Ultimate Beaver Posts: .wsv-match-height .uabb-blog-posts
Posts Grid: .wsv-match-height .fl-post-grid-post
View User Registration Plugin Whitelist.php
/* https://wordpress.org/plugins/user-registration/ */
function ur_validate_user_email( $single_form_field, $data, $filter_hook, $form_id ) {
$value = isset( $data->value ) ? $data->value : '';
$whitelist = array( 'domain1.com', 'domain2.com', 'domain3.com' );
$parts = explode( '@', $value );
if( ! in_array( $parts[1], $whitelist ) ) {
View User Registration Plugin Blacklist.php
/* https://wordpress.org/plugins/user-registration/ */
function ur_validate_user_email( $single_form_field, $data, $filter_hook, $form_id ) {
$value = isset( $data->value ) ? $data->value : '';
$blacklist = array( 'gmail.com', 'hotmail.com', 'outlook.com', 'aol.com', 'mail.com', 'yahoo.com', 'icloud.com' );
$parts = explode( '@', $value );
if( in_array( $parts[1], $blacklist ) ) {
View Public Posts Preview Expiration Time.php
/* https://wordpress.org/plugins/public-post-preview/ */
add_filter('ppp_nonce_life', 'my_nonce_life');
function my_nonce_life()
{
return 60 * 60 * 24 * 14; // 14 days
}
View Redirect default WordPress resitration page.php
function wsv_registration_page_redirect()
{
global $pagenow;
if (strtolower($pagenow) == 'wp-login.php' && strtolower($_GET['action']) == 'register') {
wp_redirect(home_url('/registration'));
}
}
add_filter('init', 'wsv_registration_page_redirect');
View Gravity Forms Send Notification as Text.php
/* Place in functions.php - Notification name must match */
add_filter('gform_notification', 'change_notification_format', 10, 3);
function change_notification_format($notification, $form, $entry)
{
GFCommon::log_debug('gform_notification: change_notification_format() running.');
// Do the thing only for a notification with the name Text Notification
if ($notification['name'] == 'Admin Notification') {
GFCommon::log_debug('gform_notification: format changed to text.');
// Change notification format to text from the default html
View Gravity Forms Name and Email on Separate Lines.css
.gform_wrapper .ginput_complex .ginput_right,
.gform_wrapper .ginput_complex .ginput_left,
.gform_wrapper .ginput_complex .name_first,
.gform_wrapper .ginput_complex .name_last {
float: none !important;
width: 100% !important;
}
View Hide WordPress Dashboard Left Menu Items.php
function wsv_hide_menu_custom(){
global $current_user;
$username = $current_user->user_login;
if( !in_array ( $username, array('User1','User2')) ){
// To remove Posts menu items
remove_menu_page( 'edit.php' );
}
}
View Hide WordPress Admin Bar Frontend.php
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}
You can’t perform that action at this time.