My working experience at WPMU DEV

WPMU DEV is one of the leading WordPress based product and service companies; and also where I have been working since 2013. From the beginning, WPMU DEV has contributed a lot to the WordPress community. Besides, they have some awesome products and services like Hustle, Hummingbird, Defender, WP Smush Pro, WP Academy, a really awesome drag and drop theme builder – Upfront, Upfront Builder (with which you can create your own theme and sell it in a marketplace with zero or little coding knowledge), and many more.

Incsub LLC is the parent company of WPMU DEV. They are also the parent of CampusPress and Edublogs. They are also going to introduce WordPress Managed Hosting very soon.

There are 70+ members working in this team across the world and I am really proud to be part of this giant team. I am sharing my WPMU DEV Journey.

I was not a WordPress guy back then. Read More

post

Easiest but powerful encryption in PHP

For a secured system, most of the data is encrypted in server end and sent to database. And after fetching the data from database, just decrypt before showing in front end.

There are lots of procedure to encrypt the data, lots of encryption algorithm out there. But, here we will use a simple encryption method though it’s powerful 🙂

We are going to use mcrypt library of php for this method. You can install the library following the instruction below: (based on Ubuntu) Read More

post

Gulp tutorial for beginners

In a sentence, Gulp is a task runner.

Gulp makes our life easier. In a development workflow, we need to do some tasks frequently and gulp can do some tasks automatically. Don’t think gulp is a replacement of grunt, but it is being improved very very fast.

Gulp is a task/build runner for development. It allows you to do a lot of stuff within your development workflow. You can compile sass files, uglify and compress js files and much more. The kicker for gulp is that its a streaming build system which doesn’t write temp files.

In this article, I will show you to create a simple WordPress plugin taking advantage of gulp. I am using MAC OS (OS X Yosemite) and MAMP as server. Read More

post

How to use SSL in localhost

There are lots of stuffs we need to test with SSL. There are some SSL providers that provide free SSL we can use those in our site. Among free SSL providers, I prefer to use CloudFlare, it’s very easy to use and nothing to setup though it needs ~24 hours to activate. Also, developers from countries where we don’t have super high speed internet, we are used to work in locally hosted site. So, usually we can’t use SSL in local site – in other words most of the developers doesn’t know. But it’s possible, and even it’s not complex at all! Read More

post

How to apply coupon automatically on WPMU membership2 checkout

Membership 2 is an awesome plugin to sell your content. That being said, you can charge your members to see your site content.

If you want to give discount, you can use Coupon addon. You have to enable from Membership 2 > Addons and then you can create coupons and share with your users. Today I will show you a trick to share coupon embedded with URL. You can share your URl like domain.com/?coupon=XXXX and the XXXX coupon will be automatically applied on checkout. Read More

post

Assign a membership to a registered member automatically – Membership 2 (WPMU)

WPMU DEV has released the new revamped version for membership plugin, called Membership 2. The layout and interface is awesome of the plugin and I am personally impressed. There is a new type of membership introduced in the plugin – Default Membership. This membership will work for the user who are just registered but didn’t choose any membership to join.

But what if you want to assign a regular membership to that user? Here is a simple code snippet that will help you to do this job:

Just make sure you change to correct membership ID for $membership_id variable.

You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name ‘mu-plugins’. If there is no folder in that name, then create a folder, name it ‘mu-plugins’, create a file inside that, give any name you like and paste the code in there. You don’t need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

post

How to use custom post type archive as front page

We can easily set any page as front page from Settings > Reading. It can be any static page. But what if we want to set an archive or CPT archive page as front page?

There are many ways to do so. We can create a custom page template, and write our code to get the posts for the post type (will look like an archive). Then create a wordpress page using that page template and select that page as front page from Settings > Reading.

This is a little complex if you are not a developer. Or even if you use a custom theme. Let’s do it in another way.

What you need is to have a file inside your theme for archive – archive.php. For CPT the file name will be archive-{CPT}.php. We will use the same file to make our home page.

For example, if your CPT archive url is domain.com/my_cpts then we want to see exact same layout and same content of domain.com/my_cpts in domain.com/.

What I love to do in this case is to use a very simple snippet. Where I just need to set the CPT name, that’s it. Here is the code:

You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name ‘mu-plugins’. If there is no folder in that name, then create a folder, name it ‘mu-plugins’, create a file inside that, give any name you like and paste the code in there. You don’t need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

Note that, here CPT means Custom Post Type

Enjoy!

post

Defer parsing of javascript to improve performance in wordpress

Nothing for introduction, hehe! A very small snippet which will help you to defer parsing all javascript files except jquery in wordpress. Here is the code:

You can add those codes in your functions.php in the theme, if you think your theme won’t be changed. Otherwise mu-plugins is the best solution. To use mu-plugins, go to /wp-content/ and find the folder with name ‘mu-plugins’. If there is no folder in that name, then create a folder, name it ‘mu-plugins’, create a file inside that, give any name you like and paste the code in there. You don’t need to activate that plugin. Mu-plugins means must use plugins, so it will be activated automatically always. If you use mu-plugins then add a php start tag at the beginning of the code.

post

Why you shouldn’t use one click installer to install wordpress

Yes, you will fall at the mid-ocean, trust me!

Well, most of the bloggers just maintain a simple blog so usually they don’t need to worry. They just need to keep a regular backup. But if you are planning to run a business site in wordpress and if that site is your everything, never ever use one click installer to install wordpress! You’d be better off installing it manually which may take you a few minutes longer to install.

Here you can get an idea about manually installing wordpress:
codex.wordpress.org/Installing_WordPress
www.siteground.com/tutorials/wordpress/wordpress-installation.htm

If you want to install manually, download wordpress from here. Then you can upload this through ftp. You can use several ftp client such as – filezilla, coreftp, fireftp (a firefox add-on) etc. You can know about uses of filezilla here.

Why you shouldn’t?

  • Big WordPress Security Risks
  • Exporting and importing content with WordPress’s built in export tools
  • They use old scripts. Updated versions of WordPress or any script are not immediately released on those services. They install an outdated version of WordPress. It’s not a good start with outdated one.
  • They bypasses almost all settings used for installing
  • Sometimes it has issues while you want to upgrade.
  • Suppose first created database is wpdb1 and the next one is wpdb2 and so on. Malicious hackers know this is how they’re created and it gives them more ammo.
  • Created a file named fantversion.php (or something similar), which is common for all auto installers. This is a security risk if crackers know how to break into it.
  • The auto created database name and the database username is same in most cases.

So what if you have already installed?

  • First of all, keep a backup of whole site and the database.
  • Download latest wordpress from WP rep. (see above for link)
  • Delete wp_admin and wp_includes folder via ftp.
  • Extract the zip and upload only wp_admin and wp_includes folder via ftp.
  • Change (alter) the database name, db username and password.
  • Put the changed db name, db username and db password in wp-config.php.
  • Get new auth key, salt etc from api.wordpress.org/secret-key/1.1/salt
  • Copy and replace the keys in wp-config.php
  • Uninstall the plugins that come with default one-click installation

It should work.

WordPress is a 15min install when completely secured and optimized through htaccess. So it’s your decision what will be your route. I just showed you some examples, if you do a little research over google you will get lots of ideas about it.

Hope you will enjoy! :)

post

How to convert hexadecimal color value to RGB value in php

Most of the CMS provides a color picker in admin panel to user to choose a color. And almost all of the color pickers return the color code as hexadecimal mode, e.g. #4EE4D3. So, you can just get the value and set the color in css. For example:
[php]

body{
background:
}

[/php]

This is a very good practice. Problem occurs if you want to put a opacity option to the user. You can set background opacity with hexadecimal color value. You must use RGBA filter, so RGB color mode as well. Like:
[css]
body{
background: rgba(233, 122, 234, 0.7);
}
[/css]

So, we need to convert the hexadecimal value to its equivalent rgb value. Here is a very small function that will do the job:

So using this function you will get the rgb value, and with that you use the opacity :)

Hope you will enjoy! :)