Gravity Forms: Retain the Form After a Form Submitted

By default, if you use Gravity Forms, after you complete a form, a notification will be shown, and the form will be dismissed. Below is the script to retain the form after a form is submitted.

Just paste into functions.php and change the _id with the form ID.

I found this script somewhere, but I will credit the original source once I found it.

snippet, Wordpress, , Leave a comment

How to set posts redirect to a new domain

I’m moving out a blog to a new domain, and redirect all posts specifically to a new domain.

http://olddomain.com/category/postname

should go to

http://newdomain.com/category/postname

Apache Server

On Apache that allows .htaccess, you can add this line on top of the file:

Nginx Server

On Nginx, add this line on server block configuration file:

Reload or restart Nginx for the change to take effect.

 

Linux, snippet, Uncategorized, Wordpress, , , , , Leave a comment

Adjust WordPress JPEG Resize Quality

Got your latest images pixelated after uploading it to WordPress? Yes, that could be irritating especially on Photography sites.  WordPress has a function to adjust the level of the image quality, as described on Developer Code Reference.

Simply put this small code to your functions.php

Adjust return number to set the level of compression.

100 = No Compression applied. Change it moderate compression about 80. Anything below 80 will make your images looks pixelated but produced a minimum of file size.

snippet, Wordpress, , Leave a comment

Add Custom Size Image to Media Popup in WordPress

In WordPres 4.5, my old function to add a custom size to media uploader seems not working anymore. But I found that new way to add custom size image is a lot simpler using image_size_names_choose filter.

Basically when you create your own image sizes using the add_image_size function:

you can just add the new sizes to image_size_names_choose:

Screen Shot 2016-06-06 at 4.36.51 PM

PHP, snippet, Wordpress, , Leave a comment