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
/* | |
* Admin user page custom column - Capture User Last Login | |
* https://www.nuno-sarmento.com | |
*/ | |
add_action('wp_login','ns_capture_user_last_login', 10, 2); | |
function ns_capture_user_last_login($user_login, $user){ | |
update_user_meta($user->ID, 'last_login', current_time('mysql')); | |
} | |
//Display Last Login Date in Admin | |
add_filter( 'manage_users_columns', 'ns_user_last_login_column'); |
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
/** | |
* Restrict files bigger than 1mb to all users expect the ones inside of the array | |
* https://www.nuno-sarmento.com | |
*/ | |
add_filter( 'upload_size_limit', 'ns_change_upload_size' ); | |
function ns_change_upload_size(){ | |
/* setup an array of user ids to not be affected */ | |
$restrictupload = array( 1, 14, 17, 37, 14263, 14289 ); |
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 CSS in the file referenced below, then create the appropriate logo in assets/img/logo-login.png | |
*/ | |
function ns_login_logo_one() { | |
?> | |
<style type="text/css"> | |
body.login div#login h1 a { | |
background-image: url(https://danielgb.wpengine.com/wp-content/uploads/2018/10/Daniel-Greenberg-logo1.png); | |
background-size: 200px 65px; | |
padding-bottom: 30px; |
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"> | |
/** | |
* Gravity Wiz // Gravity Forms // Disable Submission when Pressing Enter | |
* https://gravitywiz.com/disable-submission-when-pressing-enter-for-gravity-forms/ | |
*/ | |
jQuery(document).on( 'keypress', '.gform_wrapper', function (e) { | |
var code = e.keyCode || e.which; | |
if ( code == 13 && ! jQuery( e.target ).is( 'textarea,input[type="submit"],input[type="button"]' ) ) { | |
e.preventDefault(); | |
return false; |
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
/** | |
* SVG Support | |
* | |
*/ | |
function ns_svg_mime_types($mimes) { | |
$mimes['svg'] = 'image/svg+xml'; | |
return $mimes; | |
} | |
add_filter('upload_mimes', 'ns_svg_mime_types'); |
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( 'template_redirect', 'wc_custom_redirect_after_purchase' ); | |
function wc_custom_redirect_after_purchase() { | |
if ( ! is_wc_endpoint_url( 'order-received' ) ) return; | |
// Define the product IDs in this array | |
$product_ids = array( 37, 25, 50 ); // or an empty array if not used | |
// Define the product categories (can be IDs, slugs or names) | |
$product_categories = array( 'clothing' ); // or an empty array if not used | |
$redirection = false; |
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('woocommerce_before_cart', 'ns_check_category_in_cart'); | |
function ns_check_category_in_cart() { | |
// Set $cat_in_cart to false | |
$cat_in_cart = false; | |
// Loop through all products in the Cart | |
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { |
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
{ | |
"key": "group_5c599a7119fec", | |
"title": "Clients slider shortcode", | |
"fields": [ | |
{ | |
"key": "field_5c59a7e3fe75a", | |
"label": "How to use the slider", | |
"name": "", | |
"type": "message", | |
"instructions": "", |
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
// ACF options | |
if( function_exists('acf_add_options_page') ) { | |
acf_add_options_page(array( | |
'page_title' => 'Theme General Settings', | |
'menu_title' => 'Theme Settings', | |
'menu_slug' => 'theme-general-settings', | |
'capability' => 'edit_posts', | |
'redirect' => false | |
)); |
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> | |
$(".myDIV-0, .myDIV-1").click(function() { | |
window.location = $(this).find("a").attr("href"); | |
return false; | |
}); | |
</script> | |