If we use typejs in our document this type of issue will occur find below code to fix.
$(“.textarea”).bind(‘keypress’, function(e) {
if(e.which == 32){
var textarea_val = $(“.textarea”),
val_ask = textarea_val.val();
textarea_val.focus().val(“”).val(val_ask);
}
});
Month: November 2016
Sessions functionality in jQuery
Find below code for handling sessions in jQuery.
/*Set session value*/
$.session.set(‘session_key’, ‘a value’);
/*Get session value by key*/
$sess = $.session.get(‘session_key’);
/*Remove session*/
$.session.remove(‘session_key’);
/*Remove all sessions*/
$.session.clear();
HTTPS redirection code for htaccess
/*Total website redirect to HTTPS*/ ExpiresActive On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] /*Redirect specific page to HTTPS*/ ExpiresActive On RewriteCond %{SERVER_PORT} 80 RewriteCond %{HTTPS} !=on [NC] RewriteCond %{REQUEST_URI} /page_path/ RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
Browser close & reload events in jQuery
/*Browser close jQuery event*/
Put this code body tag –> onunload=”doUnload()”
Below code for script
function doUnload()
{
if(window.event.clientX < 0 && window.event.clientY <0){
var cookieName = ‘suitebeb123’;
$.removeCookie(cookieName);
}
}
/*Broser reload javascript function*/
window.onbeforeunload = function (e) {
// Your logic to prepare for ‘Stay on this Page’ goes here
}
Cookies functionality in jQuery
/*Create cookie*/
$.cookie(cookieName, cookieValue);
/*Create cookie with expiry time*/
var expDate = new Date();
expDate.setTime(expDate.getTime() + (15 * 60 * 1000));
$.cookie(cookieName, cookieValue, { expires: expDate });
/*Get cookie value*/
var cook = $.cookie(‘cookieName’);
/*Remove cookie value*/
$.removeCookie(‘cookieName’);
Uncaught ReferenceError: vsprintf is not defined in wordpress
Uncaught ReferenceError: vsprintf is not defined is a javascript error.
My suggestion in WordPress using w3 cache plugin within this plugin Deactivate Minify option because of this js error will generated.
Featured Images missing from my RSS feed?
function featuredtoRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = ‘div html tag open‘ . get_the_post_thumbnail( $post->ID, ‘medium’, array( ‘style’ => ‘margin-bottom: 15px;’ ) ) . ‘div html tag close‘ . $content;
}
return $content;
}
add_filter(‘the_excerpt_rss’, ‘featuredtoRSS’);
add_filter(‘the_content_feed’, ‘featuredtoRSS’);
svg image file not allowing in emails
Some of emails not allowed svg files in emails find below possibilities.
SVG file in image tag src find below
AOL Web – YES
Outlook 2013 – NO
Outlook.com – YES
Yahoo! – YES
Mail (OSX) – YES
Mail (iOS) – YES
Gmail – NO
Gmail (iOS) – NO
Gmail (Android) – YES
Android – NO
For more information about SVG file in emails please find https://css-tricks.com/a-guide-on-svg-support-in-email/
How to send mail to multiple email recipients using wp_mail
Please find below code to send mail to multiple email recipients.
$group_emails = array( ‘mail1@gmail.com’, ‘mail2@gmail.com’, ‘mail3@gmail.com’, );
wp_mail($group_emails, $subject, $message, $headers);