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 Refference.

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 minimum of file size.

Screen Shot 2016-06-06 at 4.36.51 PM

Add Custom Size Image to Media Popup in WordPress

In WordPres 4.5, my old function to add custom size to media uploader seem not working anymore. But I found that new way to add custom size image is 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

Equal Div Height with JQuery

Jquery is a fast solution if you need support on your  HTML layout. Having issue to keep your divs in an equal height? Check out this cool and easy script to keep your divs in an equal height: Jquery Match Height Plugin.

If you are on WordPress, you can try this simple line on ‘functions.php’ file:

Call the function on header or footer:

Or you can simply use a plugin to add the codes above.


Get Page ID or URL From a Slug in WordPress

This is interesting, with years experience working with WordPress, I’ve never dealt with this kind of issue. I searched the codex, and found get_page_by_path is the ideal solution instead of directly create query to database.

To get a page ID simply add the slug to the function

I creates a function to simplify the usage

And use it in real life