Upgrading PHP to PHP7.0 in a CentOS server with Vesta CP

Latest VestaCP comes with PHP5.6 by default. In this article, we will see how to upgrade PHP to it’s latest version, i.e PHP7.0 First, we need to add the correct REMI repository and enable remi update, remi release and remi-php70 repository. Here’s how Now stop apache2 and remove the existing php package that comes with … Continue reading Upgrading PHP to PHP7.0 in a CentOS server with Vesta CP

How to prevent someone or some role from accessing the WordPress admin panel

It might be required sometime to prevent a user or all users with a specific role from accessing the WordPress admin panel. It’s not tough. Let’s think that we want that all users with author role will not be able to access the admin panel. All you have to do is just add the following … Continue reading How to prevent someone or some role from accessing the WordPress admin panel

Creating a slack bot using PHP to monitor your envato sales

Slack is awesome. Slack is the de-facto of modern team communication and I am pretty sure that this is not the first time you’re hearing something like this about slack. But if you’re really never used slack, oh boy, I feel pity for you🙂

Anyway, in this article we’re going to make a slack bot that will monitor the sales in our envato account and notify from time to time as soon as someone purchased an item. Pretty useful, eh?

Bootstrapping

Considering you have a slack account, log into it and open a new channel, for example “#sales”. Now go to http://your_slack_url.slack.com/services/new or just click on “Configure Integrations” from your slack app.

Continue reading “Creating a slack bot using PHP to monitor your envato sales”

Packaging thirdparty plugins with your WordPress theme using TGM Plugin Activation library

When you’re shipping your theme for sell, it’s often required to bundle the required plugins. Some people just keep these plugins like general vendor libraries inside their theme and load them using php’s require_once. However, if you’re following this style, your themes will fail to pass the theme check because these plugin files will be considered as a part of your theme, and it will prompt you that CPT functions and shortcodes should be a part of the plugin. Moreover, if someone deactivate your theme, those shortcodes and CPTs will be unavailable immediately.

This is why, along with many other developers, we use TGM Plugin Activation library. This tiny little lib can force or suggest installing the plugins which are required (or good to have) for making your WordPress theme work flawlessly.

TGM can work with plugins which are hosted in WordPress plugin repository, or in a github public repository. It can also work with plugins which are shipped with the theme as a separate zip file. In this article we’ll see all these three cases of plugin installation and activation process using TGM library.

Bootstrapping

Download the TGM library from http://tgmpluginactivation.com/download/. After unzipping, keep the class-tgm-plugin-activation.php file inside vendors/tgm/ inside your theme. Then add the following code in your functions.php Continue reading “Packaging thirdparty plugins with your WordPress theme using TGM Plugin Activation library”

Generate Dummy Placeholder Images in the WordPress Export File Instantly

It’s a common problem for the theme developers who sell their themes in the marketplaces and ships a data file with it, that contains exported data from the demo WordPress site. The problem is, this content file contains links to the images used in the demo. And those images, which the author uses to decorate … Continue reading Generate Dummy Placeholder Images in the WordPress Export File Instantly