WordPress Idea: Displaying Image File Size in Media Uploader

Many web publishers and bloggers are concerned about the page load speed and time. It is common knowledge that speed affects how search engines rank a website in search results. One of the heaviest element on any web page is often images. The more images you use the more time it takes for a page to load completely.

I noticed that when we upload an image in WordPress using the media uploader while writing a post, WordPress shows us image dimensions right below the filename. Today, I submitted an idea to display image file size as well. Even though most users are now used to optimizing images before uploading them to WordPress. However, sometimes you may upload an image without optimizing it first. This tiny little text could be a nice reminder to check your image size before you finally insert it into post.

Here is a mockup of my idea:

Displaying image file size in media uploader

If you like this idea, then I will need your help. Please visit this idea on WordPress Ideas and vote for it.

Update: I submitted a feature request ticket to the core trac. It is currently marked for future release. QasAshraf is currently working on a patch.

Shortcode Output Appearing On Top of Post Content in WordPress

While browsing WordPress support forums, I often see threads where users are asking the question ‘Why my shortcode output jumps to the top of the page content?’. Users asking this question are using a shortcode which outputs something and instead of appearing at the exact position where shortcode is placed, their shortcode output appears above rest of the post content.

The problem is actually very simple. The function executed by shortcode should return the output instead of echoing it.

Example of a shortcode using echo to display output:

function bad_shortcode_function($atts, $content = null) { 
echo '<p>This is the output of shortcode</p>'; 
add_shortcode('bad-shortcode', 'bad_shortcode_function');  

The code displayed above would echo the given output but when you add more content to the post or page where shortcode is placed this echo will not appear where the shortcode is placed. The correct way to use shortcodes is to use return. Like this:

function good_shortcode_function($atts, $content = null) { 
$string = '<p>This is the output of shortcode</p>'; 
return $string; 
add_shortcode('good-shortcode', 'good_shortcode_function');   

Now if you want to output multiple lines of HTML you can add multiple lines to your output string like this:

function good_shortcode_function($atts, $content = null) { 
$string = '<p>This is the output of shortcode</p>'; 
$string .= '<p>This is the second line of output appended to the first string</p>';
$string .= '<p>And the third line</p>';
return $string; 
add_shortcode('good-shortcode', 'good_shortcode_function'); 

Hopefully this will help some new plugin developers and WordPress users who are trying their hands on shortcode for the first time. PS: if you recently worked on some awesome shortcode, please feel free to share the snippet below.

Translating Web Apps into Urdu

Urdu language was born out of several languages. Mainly it borrowed its vocabulary from Sanskrit, Hindi, Persian (Farsi), Turkish, and Arabic. Urdu is extremely flexible in adapting words from other languages. For example, currently in every day Urdu language, as well as Urdu literature, words from Western languages are commonly used. Words like editor, president, university, college, school, and many others, are commonly used and understood.

The reason that why several literary giants, newspapers, and educational experts, prefer to use English words instead of finding their Urdu replacement, is simply because Urdu is not designed to invent or make words up as you go. When you are finding a translation for a word like University in Urdu, you are basically looking for a word from any of the Urdu’s parent languages such as (Arabic, Turkish, Sanskrit, Farsi, etc). These other words are not as commonly spoken as the original English language word, hence trying to translate these words into Urdu is basically an attempt to make Urdu a much less practical language.

Urdu is a very practical language, mainly because it can swiftly and smoothly accommodate new words. Let’s take a look at some examples. I was looking at how some people are trying to translate Facebook. There was this phrase:

{name1} shared {=a link}.

Some suggested translations for this sentence were:

‎{name1}‎‏ نے ‎{=a link}‎‏ بانٹا۔

‎{name1}‎‏ نے ‎{=a link}‎‏ کی تشہیر کی۔

‎{name1}‎‏ نے ‎{=a link}‎‏ کا اشثراک کیا۔

‎{name1}‎‏ نے ‎{=a link}‎‏ مشترک کیا ہے۔

For any Urdu speaking Facebook user, these words make no sense. Simply because Sharing is a web feature, Facebook users associate this with a feature provided by the Facebook. This feature is common in thousands of other web applications, and every Urdu speaking internet user knows what sharing means. Insisting on translating this into a Urdu word would cause confusion.

Since there is no organization or authority that can validate and recommend people to stick to one word for a web feature, and since translating web applications has been democratized, translators are going to submit multiple translations for each sentence.

Now let’s take a look at who is actually translating web apps into Urdu? These are usually people who self-driven and motivated to keep their language alive on the web. Many of these users think that translating means they should literally translate everything, even if translating means rendering the web app practically useless for the average user. This means that there is a much greater chance of Facebook starting using sentence:

‎{name1}‎‏ نے ‎{=a link}‎‏ بانٹا۔

For an average Urdu speaking Facebook user, this sentence is not only incorrect, but it is also confusing, and they would find it hard to guess whether it is the same sharing feature or something else. Same goes for the rest of the translations. The most accurate, user-friendly, and ideal translation for the sentence would be:

‎{name1}‎‏ نے ‎{=a link}‎‏ شیئر کیا

In this sentence the word Share is written as it is in Urdu alphabet, making it easy to understand, user-friendly and practical.

I believe that there is no need to reinvent words that are part of the lives of Urdu speaking internet users. Words such as copy, paste, submit, email, web page, and many others are part of our every day lives where we use them in our every day Urdu fluently and with in context. These words are understood, recognized and are already part of the vocabulary. I feel that our fear of importing too much Western words into language are baseless and unrealistic. Trying to combat this battle will drive people away from using Urdu on their web applications.

If we just want to translate web applications that no one will use, then sure go a head, use alien-sounding, Persian and Arabic words for common tasks, functions and features. But if we want people to use web applications in Urdu then we must make translations smooth, fun, easy and practical.

Young, Brilliant, and Right – What Happened to All of Us?

When I was young, I used to hang around on an online forum. The forum’s founder was a wonderful German guy. He took special interest in me and encouraged me to learn things. It was because of him that I started learning PHP, CSS, HTML. He gave me free web hosting and even bought me a domain name. Apart from him, no body else liked me on the forum.

The reason for my unpopularity on the forum was simply that I was arrogant and rude. I admit that I knew nothing about anything at all. Yet I pretended to be know-it-all. I was also very opinionated and very good at trolling. Thankfully this phase of mine didn’t last very long and I realized my place in the world pretty soon.

I am a moderator on a very active Facebook group, called Pakistani Probloggers. We have a guy just like me on the forum. Well not exactly like me, I think this guy is much more arrogant, inconsiderate, rude, and basically a smart troll. Each day other users and moderators have complains against him, and each day he has complains against moderators and other users. Since he is a smart troll, he is kind of always good at presenting his case which makes him look so right. I know this very well because I was a smart troll myself.

He made me realize how annoying I was, and how kind, generous, and considerate was the moderator of our little online community was. He knew I had some kind of talent and he made me use it and he left a huge impact on my life. For that I will be eternally grateful to him. He told me that even though I was right but I am not fair to other people and I should not provoke and troll other users. I didn’t understand how bad I was. I thought other users are jealous of me.

I was so naive at that time, the world looked so simple to me, I thought I could do anything I wanted to do. In real life I was a very shy introvert with no social skills at all. But on the online world, I felt so confident, charming, manipulative and even cunning at times.

I am a grown up now and understand that the world is nothing like it seemed. It is a complicated place, people are not as easy going and as forgiving as I thought they were. Conquering the world is not an easy task and I am not that special.

But I miss the guy I used to be. The world from his eyes looked like such a fun little place.


Thank God! Finally…. They are Dead

Some people just don’t know how to make others feel happy. It is not for lack of trying, they are just unlucky that way. Their lives are the plain texts of sorrow and misery. As they grow older, all their good things become bad things. They usually live longer and end up growing into a painfully annoying old person. Everyone openly wishes they were dead. But they stick around for a very long time.

All their lives they try very hard to bring something good to people around them. But anything good that they say, try, or wish for is often considered rudeness, taunting, nagging, annoying noise by people around them. Each day everyone dislikes them just a little more than yesterday.

These unlucky people are actually kind generous people. But the very few people who understood their kindheartedness die away, until no one remembers that they were not always that annoying. Their children, grand children, in-laws, and relatives everyone knows them as one of the rudest, ugliest, sickest old person alive. The most popular whisper on their funeral is usually a loud announcement, “Thank God! we thought he/she would never die”.

No one visits their graves, and no one wants to remember them after their death. All this effort they did all their life was for nothing. They failed to make anyone happy including themselves. They failed to improve anyone’s life.

This failure, is probably a very common story behind so many gravestones. People who loved too much and it sucked.

(Photo Credit: Brad.K)

Best Social Media Plugin for WordPress: Floating Social Bar

I have tried many social media plugins on different WordPress sites. During my previous jobs, freelance work, and on my personal blogs. The problem with most WordPress social media plugins is that they are usually full of features that I don’t need. Just like most other bloggers, I also want simple buttons that make it easier for users to share content. I don’t want to copy Mashable, or TechCrunch, I just want something that is not too obstrusive and just works. In my quest for best social media plugin I often ended up with something slow and bloated. Recently, my boss Syed Balkhi released Floating Social Bar plugin which solved the problem for me.

Best Social Media Plugin

Like I said earlier that most bloggers just want a simple and elegant solution to add social media buttons with their articles and posts. I think Floating Social Bar solves this problem.

Floating social bar in action

Speed: Floating social bar loads faster than other social media plugins for WordPress. Most other plugins just slow down your site too much and ruin the page speed and user experience.

Compact: There are just a few social media websites included in the plugin. These are the websites that most people actually use and are more likely to share your content on these websites.

Non-Obstrusive: Unlike other social media plugins which scroll down and follow your eye balls, Floating social bar sticks to its position at the top and gets out of the way. It is really annoying when I am reading an article and a huge ugly social media widget is right next to the text. Floating social bar sticks at the top and if you want you can disable that feature too.

Who should use Floating Social Bar?

If you care about user-experience on your website and find other plugins bloated and difficult to use and configure then you will like Floating Social Bar. It is very easy to install and set up. Simple install and activate Floating Social Bar plugin and go to Settings » Floating Social Bar to configure the plugins. Drag and drop social media websites you want to include and add your twitter username. Save your changes and preview your website.

Floating social bar plugins

Previously when I was using Digg Digg I had to add custom CSS to draw borders that separated post title and content from the social sharing button. Floating Social Bar works out of the box and the base CSS should look good with most WordPress themes.

Conclusion: Floating social bar is a simple and easy way to add social media buttons to your posts. It is elegant, usable and does not slow down a site. Give it a try on your website.


Out-Dated and Poorly Written WordPress Tutorials

It is fun to make sense of a poorly written tutorial with bad code. Last night I found an old tutorial with a nice idea but some mistakes with the code. I decided to write a better version of that tutorial. Fixing it was like a puzzle, and I enjoyed it. Now we will be publishing a more accurate and up to date version of that tutorial on WPBeginner, which will actually help more people.

Many WordPress businesses usually have a blog where they occasionally publish tutorials. These tutorials are mostly submitted by guest bloggers, who are also either running a small WordPress business of their own, or promoting themselves as freelancers. I feel that WordPress businesses should have blogs more focused on their products and information related to it. This would make those blogs more interesting. Correct me if I am wrong, but I think that using blogs to bring traffic and using them as link bait is a thing of past now.

But who am I to judge any one, if this strategy works for their business, then I guess there is nothing wrong with it. However, this strategy sometimes affects the users. Who come to these blogs, thinking that it’s a nice brand, they must have written something great about the problem I am facing. They land on a guest post which is not actually written by the company behind the website. They follow the tutorial, which may or may not work. The tutorial may have poorly written code snippets which these unsuspecting users add to their sites. The guest blogger may not have done that on purpose, but they are very less likely to revisit that post and update their code.

Another problem that I have noticed is that sometimes these tutorials can get very out-dated. At WPBeginner we regularly try to update our old articles. But I have not seen much effort in this regard on other websites. I think it is wonderful that they can attract guest bloggers to write such lengthy tutorials. But they should also pay someone to keep these tutorials up to date. It should be an actual job where a person or team actually keeps tutorials up to date.