When retrieving records from tables in our database, you often have to write combined expressions in WHERE clauses like [sourcecode language=”sql”] SELECT * FROM users WHERE status=1 AND (fname = ‘John’ OR lname=’Doe’) [/sourcecode] The query above is pulling out all users who’s status is set to 1, and fname is equal to ‘John’ or … Continue reading Working with combined expressions in WHERE clauses in Laravel 4
Selecting a group of DOM elements is super duper easy these days using CSS selectors, or a particular element via their ID. But what about picking up a random element from these group of elements? In this article I am going to show you how to do it by extending jQuery Let’s consider that we … Continue reading Picking up random elements from DOM using jQuery
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
When you are developing a theme, or maybe writing a plugin, it is often required to display related posts in single posts page. These related posts are fetched by various criteria. Sometimes they are fetched from the same categories a post belongs to, or by tags. Sometimes they are set by the author of the … Continue reading Find n number of posts randomly from a group of categories in WordPress
Enqueueing scripts, while being as one of the most common tasks for WordPress theme and plugin developers, has a very nice companion feature that can be used to pass data to it. These data will then be available in the native scope of those scripts. In this short article, I am going to show you … Continue reading Passing data from PHP to the enqueued scripts in WordPress
WordPress uses BackboneJS and Underscores in the admin panel. Though codex has a rich set of documentation on different WordPress topics, it lacks instructions of using these BackboneJS models in your code. So here’s a small snippet which shows you how to fetch an attachment from your WordPress blog using these models First of all, … Continue reading Fetch WordPress media files using BackboneJS
This is not a rant. It’s a post from a fan who is sad, very sad. I am a fan of Redux Framework and use it in all my themes. It’s easy to use and it has an excellent collection of controls which can make your life easier when you deal with option panels. However, … Continue reading ReduxFramework – a perfect example of how not to redesign your site!
Vesta CP comes with PHP 5.4 by default. If you want to upgrade it to 5.5, follow these steps 1. Stop Apache and Remove current PHP [sourcecode language=”shell”] service httpd stop yum -y remove php [/sourcecode] 2. Add remi repository [sourcecode language=”shell”] #For 32 Bit OS wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm #For … Continue reading Upgrading PHP to 5.5 in a CentOS 6 server with Vesta CP