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

Equal Div Height with JQuery

jQuery is a fast solution if you need support on your  HTML layout. Having an 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.

 

jQuery, Wordpress, , , Leave a comment

How to List Functions Hooked to an Action in WordPress

The key working with a theme framework is to know the use of hooks. Mostly frameworks depend on existing or their own action to add function or element. In real life, this case closely related to create child theme based on existing theme frameworks. Whether you need to add, remove or alter an element, you need what is to know the action and functions hooked on it.

I frequently working with ThemeBLVD themes, you can read actions documentation in their web page. But to figured out functions behind an action I use a plugin called Simply Show Hooks.

After you Installed it, simply click the Simply Show Hooks menu, and all actions and functions hooked in, will be shown.

drj-hooks-and-filter

There, you can remove a function or add your own. One more thing, this plugin also can show filter hooks used in a theme.

 

Plugin, Wordpress, 1 Comment

How to Display and Order Users on a Page

If you have registered users on certain role, to list them on a single page, you can use WP_User_Query

Here’s the basic loop:

You can list and order the result by adding array value, in below example I would like to order user by last name, the $arg array value should like:

That’s it let me know if you have any questions.

PHP, snippet, Wordpress, , Leave a comment