Once I was in problem of resizing colorbox iframe.
The scenario was that I have opened the colorbox iframe for opening a page and that iframe size was according to that opened page content.
Author » K K Agrawal
Redirecting to another url after contact form 7 submission
As we know, Contact Form 7 redirects to the same URL as the formโs URL after form submissions in the default settings. However, sometimes, we might need to change this to redirect on another URL after submission
Toggle class using jQuery
Sometimes we faced the problem of toggling the class in html because of only by changing the classes can do a different action in html.
Toggle class means exchange the class names. We can toggle class using jQuery as follows:
$(document).ready(function(){ if($('#id').hasClass('active')) $('#id').removeClass('active').addClass('deactive'); else $('#id').removeClass('deactive').addClass('active'); })
Merge two arrays in PHP
The array_merge() function merges the elements of one or more arrays together so that the values of one are appended to the end of the previous one. It returns the resulting array.
<?php $A1=array("apple","papaya"); $A2=array("banana","grapes"); print_r(array_merge($A1,$A2)); ?> Output would be : Array ( [0] => apple[1] => papaya[2] => banana [3] => grapes )
Increase the PHP Script execution time
set_time_limit : set/increase the PHP Script maximum execution time
By default, PHP has a set of seconds limit to execute the script, if some script reach to run then some fatal error occurs.
Arrow on scrolling the page using jquery
Sometimes we faced the problem on scrolling the content on the page and go to the bottom of the page and feel we need to go on top of the page.
For that we need to scroll the page again which is irritating. If there would be any option to click on which we can jump to top of the page easily seems good.
Opening a html page within fancybox
Opening inline HTML in a fancybox popup is easily achievable but once I faced the problem of opening a html page within the fancybox popup.
After googling, I found the solution that ‘type’ property of fancybox we need to include on calling of it.
Hide the Admin Bar in WordPress
WordPress automatically display an admin toolbar at the top of the page in frontend for logged in users.
This admin bar in WordPress is really an annoyance to me because it slightly disturb my theme design and I never want the toolbar for anything. I can hide it by using css and we can also do it in wordpress by using wordpress filter.
How to redirect to another url in wordpress?
We can redirect website visitor to another url in wordpress using wp_redirect() function.
wp_redirect() function in wordpress redirects the user to a specified url.
<?php wp_redirect( $location-url, $status ); exit; ?>
How to open fancybox on page load?
Opening fancybox on page load is very simple. just call below given code in document ready eg.
$(document).ready(function () { $.fancybox({ 'width': '80%', 'height': '80%', 'autoScale': true, 'transitionIn': 'fade', 'transitionOut': 'fade', 'type': 'iframe', 'href': 'http://www.example.com' }); });