function login_session_expired() {
// we only care to add scripts and styles if the user is logged in.
if ( is_user_logged_in() ) {
// add javascript file
wp_register_script( 'wp_auth_check', '/wp-includes/js/wp-auth-check.js' , array('heartbeat'), false, 1);
wp_localize_script( 'wp_auth_check', 'authcheckL10n', array(
'beforeunload' => __('Your session has expired. You can log in again from this page or go to the login page.'),
'interval' => apply_filters( 'wp_auth_check_interval', 1 * MINUTE_IN_SECONDS ), // default interval is 3 minutes
) );
wp_enqueue_script ('wp_auth_check');
// add css file
wp_enqueue_style( 'wp_auth_check','/wp-includes/css/wp-auth-check.css', array( 'dashicons' ), NULL, 'all' );
// add the login html to the page
add_action( 'wp_print_footer_scripts', 'wp_auth_check_html', 5 );
}
}
add_action( 'wp_enqueue_scripts', 'login_session_expired' );
// make sure the stylesheet appears on the lightboxed login iframe
function login_session_expired_styles() {
wp_enqueue_style( 'wp_auth_check','/wp-includes/css/wp-auth-check.css', array( 'dashicons' ), NULL, 'all' );
}
add_action( 'login_enqueue_scripts', 'login_session_expired_styles' );
Monday, February 26, 2024
How to increase Logout session With AJAX in WordPress
Monday, December 25, 2023
Code to Load more isotope Divis Using Jquery Ajax
<script>
$(document).ready(function() {
$('.team-filters ul li a').click(function() {
$('.team-filters ul li a').removeClass('active');
$(this).addClass('active');
});
// var selector = $(this).attr('data-filter');
var $container = $('.isotope').isotope({
filter: $container,
itemSelector: '.element-item',
});
$('#filters').on('click', 'a', function() {
var filterValue = $(this).attr('data-filter');
// use filterFn if matches value
// filterValue = filterFns[filterValue] || filterValue;
$container.isotope({
filter: filterValue
});
});
$container.imagesLoaded(function() {
$container.isotope('layout');
});
// return false;
var initShow = 6;
var counter = initShow;
var iso = $container.data('isotope');
loadMore(initShow); //execute function onload
function loadMore(toShow) {
$container.find(".hidden").removeClass("hidden");
var hiddenElems = iso.filteredItems.slice(toShow, iso.filteredItems.length).map(function(item) {
return item.element;
});
$(hiddenElems).addClass('hidden');
$container.isotope('layout');
//when no more to load, hide show more button
if (hiddenElems.length == 0) {
jQuery("#load-more").hide();
} else {
jQuery("#load-more").show();
};
}
//append load more button
// $container.after('<button id="load-more"> Load More</button>');
//when load more button clicked
$("#load-more").click(function(event) {
event.preventDefault();
if ($('#filters').data('clicked')) {
//when filter button clicked, set initial value for counter
counter = initShow;
$('#filters').data('clicked', false);
} else {
counter = counter;
};
counter = counter + initShow;
loadMore(counter);
});
//when filter button clicked
$("#filters").click(function() {
// alert("sd;lk");
$(this).data('clicked', true);
loadMore(initShow);
});
});
</script>
For Professional website contact WEB CODE ADDICT
View this post on Instagram A post shared by WebCodeAddict (@webcodeaddicted)
-
Web Design ,Logo Design, graphic design, website design: Web Design : encompasses many different skills and disciplines in the production a...
-
The Wedding is Responsive HTML theme for wedding planner websites. which helps you to build your own site. Wedding Planner theme has ...
-
<!doctype HTML> <html> <head> <meta content="text/html; charset=UTF-8" /> <title>Web Code Addict Ac...