WordPress: Cool Tips & Tricks

Below are some of cool WordPress tips & tricks that can prove very handy and help you add some awesomeness to your WordPress based website with comparatively less effort and quickly.

Include options to associate Social channels to Author profile

Author profile on Admin screen on WordPress does not include any options to add social channel information.
Step 1: Add below code to functions.php file under template folder:

This will provide you controls on User Profile page where you can add/update the links to these social channels.
Step 2: Update your page template with below code to use the information on public website:

Customize WordPress homepage to show page contents as well as blog simultaneously

WordPress allows option either to have blog posts on home screen or a static page (without blog posts) as your homepage. But, in case you want both the options on homepage itself, open home.php and use below code:

Know result count of Search query

Modify Excerpt Length and More Tags

Open your functions.php file and add the following codes in there:

Add page/post slug as id on Body Tag

This method can prove to be critical solution where specific behavior needs to be implemented on a particular page using same shared template. All JS & CSS based implementation can be done based on that ID (i.e. page slug).

Importing page content on a template

The approach provides very useful where a section is used across various pages and so we can maintain that section as separate page and import it in the page template. This way any change to the sectioned page is reflected throughout website and we won’t need to make changes everywhere.

Limit the number of search/category results per page

Add below code to functions.php file under template folder:

Redirecting to the post directly if search results returns single post

Add below code to functions.php file under template folder:

Enjoy playing with WordPress!!