Three most wanted tricks for WordPress developers

WordPress is specially crafted platform to publish content to the web. Many of the big giant content publishers are using WordPress like CNN, NYTimes, etc. You, as a content writer, finds WordPress deadly easy and super cool to work on because WordPress provides many customizations to make your content looks good and also many of us are spending time to add some spice to WordPress. Here I want you to add even more into your content writing experience.

Following are the three most wanted WordPress tricks to make your writing experience easy and even better.

1. How to restrict the authors to view only the comments which belong to their own posts in admin area?

Just open up functions.php of your current theme and put this code in it, but keep in mind if you put this code in your functions.php will only be limited to your current theme. So better to make a plugin.

As you know the comments are stored in a separate table and are identified by post_id. So, I have just modified the query which is run by WordPress whenever the comments page opened in the admin.


2. How to set first image of post as featured image?

Sometimes, we need to set our post’s first image as featured image and WordPress doesn’t give any support for this thing. You can use the following code snippet to get this functionality.

I am applying a filter to the contents of post and job done.

3. How to retrieve your Gravatar image?

Having a profile picture on your profile means great credibility and recognition on social networks and other websites, which is usually known as “avatar image”.

WordPress provides its own service know as Gravatar. We will walk you through that how to retrieve your profile image from Gravatar.

WordPress has a built in function to retrieve an image from Gravatar, this function required two parameters: ID or usre_email of the user and the size of an image.

If you want to use user email, use get_the_author_meta() function with user_email

This will give us an image of 80px.

If you know any other way of doing these tricks for WordPress, let us know in the comments below.


Leave a Reply

Your email address will not be published. Required fields are marked *