I’ll be attending WordCamp US 2015

I hadn’t attend any WordCamp before WordCamp San Francisco 2014, where I got travel assistance by the WordPress Foundation. It was an awesome experience as for the first time I went outside of my country and visited United States.

WordCamp US Sponsorship - weDevs

WordCamp San Francisco is the grand WordCamp and this year WordCamp SF was renamed to WordCamp US and will be held at Philadelphia, Pennsylvania. I am excited to say that we are one of the sponsors of WordCamp US 😀 Continue reading

CRUD Generator for WordPress

I have written countless number of plugins in the last 7+ years after I started working with WordPress and created other web applications. No matter what type of applications you are building, simple or complex, small or big, one thing is common, you have to insert some data into the database, fetch them, update them and list them. We simply call it CRUD operation.

As I primarily work with WordPress, mostly I have to do this:

  1. Register an Admin Menu
  2. A Callback Function for Listing the Items → WP_List_Table
  3. Add New Form → Handle the submission, insert items into database
  4. Update Form → Handle the submission, update items in database


It’s boring….!

Few days ago I was working on a project that requires multiple database tables and guess what, I have to do the tasks listed above for EVERY SINGLE TABLES. Are you serious? I have to write all those codes again and again for every tables. I simply couldn’t get my head around that idea of writing the codes, as a result I was stuck and no progress was being made on that project. We are programmers, we are lazy people, how could we do such a waste of energy doing the same thing?

I had to come up with a solution, I didn’t want to write the same thing every time I build a plugin. So, as always, the generator was made, out of frustration and laziness of course 😀

Here is a quick demo of the working project:

View Demo Fork in Github

Moved The Site to a New Domain

I don’t know when exactly I moved my blog to tareq.wedevs.com, but I started my blog in a free hosting site and then moved to WordPress.com.

I bought the domain wedevs.com back in 2008. At that time weDevs wasn’t a company, but I started blogging from that sub-domain, till now.

I have the bad luck not getting the perfect domain name under me, someone/some guys already booked the domains I wanted to in my name. The never used those domains, also they don’t let those go. But finally I found this one and it’s not that bad to start a brand new journey.

Bought the domain tareq.co and the VPS from DigitalOcean few months earlier, but only today I had the time to move everything back here. I wanted to start with a re-design of my site, heck it’s a long process and I didn’t want to wait that long. Hopefully I will have the time again to start blogging regularly.

Happy new journey :)

WooCommerce Add to Cart Redirect to Checkout

If you need to redirect the user directly to the checkout page instead of the current product page or cart page, put this snippet to your themes functions.php.

 * Redirect user to checkout page directly after adding to cart
 * @return string 
function wc_redirect_to_checkout() {
    $checkout_url = WC()->cart->get_checkout_url();

    return $checkout_url;

add_filter( 'woocommerce_add_to_cart_redirect', 'wc_redirect_to_checkout' );

Eloquent ORM in WordPress

If you are a plugin writer like me and you write random WordPress plugins for various purposes, chances are you have to write many SQL queries for many cases. But if you look into modern PHP frameworks like Laravel, Symfony, Zend and every other frameworks, you will see they don’t write much raw SQL queries by hand. Instead, everyone is using ORM. In few cases you might have to write raw SQL queries, with ORM you can do that as well.

If you look at the WordPress world, we are still stuck with the WPDB global object. It’s an Active Record class, but can’t be called an ORM. The main reason I like ORM is it reduces so much codes and facilitates many magical features without writing raw queries, instead of manipulate them using an Object Oriented like language. Also you can use many adapters for many databases (though it’s not possible right now in WordPress).

If you are writing a large plugin which involves many custom database tables, chances are you will get lost among those tables and queries very shortly. It happened to me as well and I was looking for using ORM’s in WordPress. But there aren’t so many good tools for that. So I looked into Laravel as it’s huge popular now a days. Laravel uses a package named Eloquent as its ORM provider. As it’s a composer package, you can easily use Eloquent into any PHP application.

There are ways to use Eloquent independently, but it requires you to create a separate connection to database. But as WordPress is already connected to the database, why create a new connection? And if we use Eloquent like that, we will miss database reporting from various debugging plugins like debug-bar, query-monitor, etc.

That’s why I wrote a composer package to use Eloquent ORM inside WordPress using the same database connection using WPDB. The benefits are:

  • Eloquent is mainly used here as the query builder
  • WPDB is used to run queries built by Eloquent
  • It doesn’t create any extra MySQL connection
  • You get to use the WordPress debug tools/plugins

The package is not perfect, but please do checkout the Github repository for detailed information and usage instruction. Pull requests are always welcome.

View on Github

My talk on Open Source Contribution in WordPress

From yesterday (09-02-2015), the biggest tech conference in South Asia is happening at BICC called Digital World Conference, 2015.

All sorts of software exhibition, tech talks, conference are being arranged in this 4 day long exhibition. There is a slot named CMS Developers Conference where we managed developers from WordPress and Joomla to give their talks. It was a blast with about 1300 attendees.

I gave a talk on Open Source Contribution in WordPress and here is the slide link.

Made my first WordPress core contribution!!

Shit just got real, all of a sudden today I made my first WordPress core contribution at this ticket and in this commit :D.

I was checking trac today and stumbled upon this ticket. It was really easy to find and replace some texts. So quickly I submitted a patch and it was accepted within few hours. I just can’t believe that, yes I am excited 😀


Bengali translation, a first time collaboration for WordPress!

Hopefully WordPress 4.0 is going to be released at 27th August, 2014. As this version is going to have language selection from the installation phase, translation is important.

As the validator of WordPress Bengali project, I proposed a translation collaboration effort to give a boost in our Bengali translation. From the banner of our local group WordPressians, today we arranged a “contributor day” to contribute in Bengali translation to WordPress and it was really great. About 30 WordPress lovers joined us in weDevs office to help the Bengali language grow. We already have completed 100% translation in WordPress part, but the Administration area was barely touched (23%). But after the announcement, now we have only about 150 strings left to translate, which was about 1800 before. So that was really an amazing effort.

We have never arranged something like this collaboratively and this worked out really good. It’s always better to do something together rather than doing it alone. More than 50% of them who never translated before. Hats off to everyone who took part at this effort 😀

Some photos…

I will be attending WordCamp San Francisco 2014

I am working with WordPress for about 6 years. Web development is my passion and I fell in love with WordPress very shortly as it was really easy to pick up and get going.

Since then, I wrote many plugins and created a lot of themes and got involved with WordPress. Also I maintain the official Bengali translation project. Though I couldn’t get my head around with WordPress trac and still I couldn’t contribute to WordPress core, I intend to do so in near future. I am watching closely WordPress development and know the community and developers around it through blogs, twitter, github and so on. But as I am living in a third world country, face to face interaction was not an option.

I see people gather in WordCamps and meet other WordPress folks in person, networking is a breeze in WordCamps. I always wanted to attend a WordCamp and this year I was planning to attend one anyhow. I chose WordCamp Europe firstly because of the cultural gatherings it brings. Countries all over the Europe and America gathers on that event, it was the main attraction to me. But sadly, it’s happening on Sofia, Bulgaria and there is no embassy of Bulgaria in Bangladesh. So I had to skip it.

Next target is WordCamp San Francisco. It should have been the first choice, because it’s The Grand WordCamp! But as it’s harder to get an US visa, I was skeptic on this. But as WCEU was out of question, WCSF was the choice. Interestingly, WCSF offered a travel assistance program this time to bring more diversity. I applied for it and luckily, I got selected. Hell yeah! 😀

I got the official invitation letter from Jen Mylo with details. I submitted my visa application on 4th August (this month) and got the visa interview date at 10th August (today), though I didn’t expect the interview date too soon. So today I attended for the visa interview and I got the visa 😀 . Well, to be specific not today, will get the passport back at 13th August.

So, if everything goes right, I will be attending WordCamp San Francisco this year. I hope it’ll be a blast and planning to arrange the first ever WordCamp in Dhaka next year. Fingers crossed 😀