Skip to content

Instantly share code, notes, and snippets.

@luiskabes-arch
luiskabes-arch / script.js
Created September 12, 2023 12:12
Change flatpickr config
//Change flatpickr config on Vacancy form
let calendar = $('#ff_5_birth, #ff_9_birth').get(0)._flatpickr;
if (calendar) {
let currentDate = new Date();
let maxDate = new Date(currentDate.setFullYear(currentDate.getFullYear() - 18));
// Convert minDate to 'd M Y' format
let maxDateString = maxDate.getDate() + ' ' + maxDate.toLocaleString('default', { month: 'short' }) + ' ' + maxDate.getFullYear();
@luiskabes-arch
luiskabes-arch / functions.php
Created July 26, 2023 08:17
Add Featured Post on Custom Post Type (With AJAX)
<?php
/**
* At the default, this is will add 'featured' meta post on the 'post' post type, to adjust it with your need
* use your IDE editor and use search & replace from your IDE to replace 'featured' & 'post'
*/
/**
* Register the 'Featured' meta box.
*/
@luiskabes-arch
luiskabes-arch / encode-email.js
Last active July 27, 2023 12:36
Encode an email on mailto: link
jQuery(document).ready(function ($) {
// Find all anchor tags with href starting with "mailto:"
$('a[href^="mailto:"]').each(function () {
var email = $(this).attr('href').substring(7); // Extract the email address
// Encode the email address for obfuscation
var encodedEmail = '';
for (var i = 0; i < email.length; i++) {
encodedEmail += '&#' + email.charCodeAt(i) + ';';
}