How to enable some useful text formatting options in TinyMCE in WordPress

Most of the time default TinyMCE editor in WordPress is pretty adequate for everyday text formatting. However, there are a lot of extra formatting options which are hidden out of the box. Enabling these options will give you extra formatting features that will be useful for many of us. In this article, I will show … Continue reading How to enable some useful text formatting options in TinyMCE in WordPress

How to enqueue javascript files properly in the WordPress admin panel

You’d probably have answered the question already, won’t you? We all know that the correct answer is to do that we have to write a function that hooks the “admin_enqueue_scripts” and inside that function we will have to load the script via wp_enqueue_scripts() function. That’s the correct answer, but when it comes to the best … Continue reading How to enqueue javascript files properly in the WordPress admin panel

QuickTip: Turn symfony's web profiler debug bar on or off

Check out your config_dev.yml and you will notice a special section over there [sourcecode language=”shell”] web_profiler: toolbar: true intercept_redirects: false [/sourcecode] You can turn the debug bar on or off anytime by changing the value of toolbar in this web_profiler section. If you want to turn debug bar off for a specific controller action, you … Continue reading QuickTip: Turn symfony's web profiler debug bar on or off

Get a list of Top 10 authors in a WordPress blog, and sort them by firstname and last name

Getting top 10 authors’s list from WordPress is actually pretty simple with a SELECT query. Here is the SQL for that which sorts the list by number of posts of each authors [sourcecode language=”sql”] SELECT wp_users.id, display_name, user_login, user_nicename, count(wp_posts.id) AS number_of_posts FROM wp_users JOIN wp_posts ON wp_posts.post_author = wp_users.id GROUP BY wp_posts.post_author ORDER BY … Continue reading Get a list of Top 10 authors in a WordPress blog, and sort them by firstname and last name

Improving UX in the WordPress Admin Panel with Interactive Meta Boxes

Our goal is simple today, we want to add interactivity to our boring metaboxes. Instead of showing lots and lots of irrelevant input boxes at once, we will properly group them into different metaboxe containers and then display the required one based on the action of another one. We will create a custom post called … Continue reading Improving UX in the WordPress Admin Panel with Interactive Meta Boxes

Limit number of posts an user can create in WordPress admin panel

If you, by any chance, want to limit the number of posts an user can create in your multi author WordPress blog, there is a nice way to do it. Add the following code in your theme’s functions.php file [sourcecode language=”php”] add_action("load-post-new.php","limit_user_by_post_count"); function limit_user_by_post_count(){ $user = get_current_user_id(); if (!current_user_can( ‘manage_options’)) { //not an admin – … Continue reading Limit number of posts an user can create in WordPress admin panel

problems uploading large files in php5-fpm and nginx – and solution to that

Today I had encountered a strange error while importing a 10MB XML file in a low end vps, where nginx was configured with php5-fpm and was working pretty nicely. But then, whenever I tried to import that file, after 25% upload the connection drops and page goes blank. It was strange and drove me nuts … Continue reading problems uploading large files in php5-fpm and nginx – and solution to that

Saving a HUGE bandwidth cost in WordPress by automatically serving media contents from copy.com

shutterstock_132384233
The title almost says it all. Our mission is to save the bandwidth cost (and ensure better deliverability) by leveraging the power of headless installation of copy.com client in Linux, and then integrating it into WordPress. The integration must work seamlessly so that the viewers don’t see a difference, and at the same time you don’t have to put any extra effort. Beside saving bandwidth, this also reduces extra load from your web server. There’s another surprise which I will tell you later. For now, keep reading 🙂

You need at least a VPS to make this setup working, preferably with root access. These days VPSes are cheap. You can purchase an 128MB VPS for ~14/yr from Ramnode (such a fantastic provider) or may be for ~19/yr from WeLoveServers. Or feel free to use your existing VPSes if you have one.

Step 1: Headless installation of copy.com app
You can use your existing copy.com or register a new one using my referral code http://copy.com?r=Tbcrni, you and I both will be getting an extra 5GB if you do so.

Now log into your linux box via SSH, you need to have root privilege to complete this step.
Continue reading “Saving a HUGE bandwidth cost in WordPress by automatically serving media contents from copy.com”