Automatically add target blank attribute for all external links using jQuery
var comp = new RegExp(location.host); $(‘a’).each(function() { if (comp.test($(this).attr(‘href’))) { $(this).addClass(‘local’); $(this).attr(‘target’, ‘_self’); } else { var href = $(this).attr(‘href’); if (href.indexOf(‘mailto’) > -1) { //mailto console.log(“sdfsdf”); $(this).attr(‘target’,’_self’); }else{ $(this).addClass(‘external’); $(this).attr(‘target’,’_blank’); } } });
Read moreHow to use CRON wget?
/usr/bin/wget -O -q ‘http://http://www.renzramos.com/your-script.php?key=test’
Read moreValidate Form Fields using jQuery
function validateField(element, e){ var restriction = element.attr(‘data-restriction’); var errorText = element.attr(‘data-error-text’); var required = element.attr(‘data-required’); var name = element.attr(‘name’); var label = element.siblings(‘label’).html(); var tagName = element.prop(‘tagName’).toLowerCase(); var value = element.val(); if (typeof restriction !== ‘undefined’){ if (restriction == ‘numeric’){ if (typeof e !== ‘undefined’){ // Allow: backspace, delete, tab, escape, enter and . if […]
Read moreCryptocurrencies Converter
https://github.com/renzramos/cryptocurrency-calculator-converter
Read moreGenerate sitemap for WordPress GTranslate
https://github.com/renzramos/generate-sitemap-for-wordpress-gtranslate
Read moreEasy Transient integration for WP Query
What is Transient API? The Transients API is very similar to the Options API but with the added feature of an expiration time, which simplifies the process of using the wp_options database table to temporarily store cached information. Reference: https://codex.wordpress.org/Transients_API Function Add this yo your functions.php // wp query transient function wp_query_transient($transient_key, $args){ $query = […]
Read more