/* change lightbox color for Responsive Lightbox & Gallery by DFactory*/
#swipebox-overlay {
background: rgba(217, 217, 109, 0.41);
}
emily sparkle
gp hide featured image
/* generatepress hide featured image on all PAGES */
.single .page-header-image-single, .page-header-image, .page-header-image-single {
display: none;
}
/* show featured image on all POSTS */
article.category-music-leaders div.page-header-image-single {display: inherit;}
change generatepress color palette
previous solution
// change gp color palette
add_filter( 'generate_default_color_palettes', 'tu_custom_color_palettes' );
function tu_custom_color_palettes( $palettes ) {
$palettes = array(
'#351C4D', /* brand */
'#FEBF7B', /* accent */
'#FF7E5F', /* action */
'#765285', /* hover */
'#C1c1c1', /* light */
'#fe7b84', /* midtone */
'#000000', /* black */
'#FFFFFF', /* white */
);
return $palettes;
}
block eric jones form spam
// Validate if Email field is spam from ERIC JONES
add_action( 'elementor_pro/forms/validation/email', function( $field, $record, $ajax_handler ) {
// Looking if email found in spam array, you can add to the array
$spamemails = array("[email protected]", "[email protected]", "[email protected]", "[email protected]");
if ( in_array( $field['value'] , $spamemails) ) {
$ajax_handler->add_error( $field['id'], 'אנחנו לא אוהבים ספאם, נסו מייל אחר' );
}
}, 10, 3 );
security headers
// security headers
<IfModule mod_headers.c>
Header always set Content-Security-Policy "default-src https: data: 'unsafe-inline' 'unsafe-eval'"
Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
Header always set X-Frame-Options "SAMEORIGIN"
Header always set X-Xss-Protection "1; mode=block"
Header always set X-Content-Type-Options "nosniff"
Header always set Referrer-Policy "no-referrer"
Header add Access-Control-Allow-Origin: "https://yourwebsiteurl.com/"
Header always set Content-Security-Policy "upgrade-insecure-requests;"
</IfModule>
protect configuration file
# protect wpconfig.php
<files wp-config.php>
order allow,deny
deny from all
</files>
use images from live site on stage
// use images from live site on stage https://johnoleksowicz.com/serve-wordpress-images-different-domain-htaccess/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(wp-content/uploads/\d+/.*)$ https://www.livedomainurl.com/$1 [R=301,NC,L]
</IfModule>
exclude categories from blog
// exclude categories from blog
function exclude_category_home( $query ) {
if ( $query->is_home ) {
$query->set( 'cat', '-63' , '1' );
}
return $query;
}
add_filter( 'pre_get_posts', 'exclude_category_home' );
gp featured post excerpt length
// gp blog - featured post excerpt length
add_filter( 'excerpt_length', function( $length ) {
global $wp_query;
if ( 0 === $wp_query->current_post && !wp_is_mobile() ) {
// Set Length of first post on desktop
$length = 50;
} else {
// Set Length of other posts and all posts on mobile
$length = 20;
}
return $length;
}, 200);
change admin link to display published products only
// change post link to display published products only
function wcs_change_admin_product_link() {
global $submenu;
$submenu['edit.php?post_type=product'][5][2] = 'edit.php?post_type=product&post_status=publish';
}
add_action( 'admin_menu', 'wcs_change_admin_product_link' );