Life runs on code

Recent Posts

A good article on wp_kses Performance

A good article on wp_kses Performance

https://www.tollmanz.com/wp-kses-performance/

WordPress Multisite Crontab using WP-CLI Raw

WordPress Multisite Crontab using WP-CLI Raw

AWS S3 Sync using Crontab

AWS S3 Sync using Crontab

Install AWS cli #Download cli script curl “https://s3.amazonaws.com/aws-cli/awscli-bundle.zip” -o “awscli-bundle.zip” #unzip unzip awscli-bundle.zip #install ./awscli-bundle/install -b ~/bin/aws Create crontab script file : sync-s3.sh #/bin/bash export AWS_CONFIG_FILE=”/root/.aws/config” #change it as per user export AWS_ACCESS_KEY_ID=XXXXXXXXXXXXXXXXXHRQ export AWS_SECRET_ACCESS_KEY=XXXXXXXfHyR /usr/local/bin/aws s3 sync /var/www/testsite.com/htdocs/wp-content/uploads s3://my-imagestore/ –acl=public-read –debug Add crontab to […]

Repairing a Corrupted Mac OSX ExFAT Partition

Repairing a Corrupted Mac OSX ExFAT Partition

I had some issues with corrupted exFAT partition that Disk Utility said it couldn’t repair. Then I finally found a solution. Run following command in terminal sudo fsck_exfat -d disk2s2 Where disk2s2 is ExFAT partition. Then it will ask you Main boot region needs to […]

WordPress 4.3 Changes in Template Hierarchy

WordPress 4.3 Changes in Template Hierarchy

In WordPress  4.3 there is a new template file added in theme template hierarchy called singular.php . This will allow theme authors to use a common template for any singular post type.

It follows the rules of is_singular() and comes after single-{post-type}.php, single-post.php, single.php, andpage.php.

Template hierarchy for singular post types
Template hierarchy for singular post types

To learn more about WordPress theme template heirarchy : https://developer.wordpress.org/themes/basics/template-hierarchy/

How to add Swap on ubuntu

How to add Swap on ubuntu

https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04

Sort directory by size in linux terminal

Sort directory by size in linux terminal

The linux “du” is a standard Unix command, used to check the information of disk usage of files and directories on a machine. Following command will sort “du” command result by size. du -hs * | sort -h

The Importance of Escaping All The Things

The Importance of Escaping All The Things

User Avatar in buddyPress notification loop

User Avatar in buddyPress notification loop

To display user avatar in buddypress notification-loop (You can find it in members / single / notifications / notifications-loop.php ) Below snippet will return user id of that activity ( BuddyPress stored it as  secondary_item ) $bp = buddypress(); $user_id = $bp->notifications->query_loop->notification->secondary_item_id; To echo avatar from user id […]

Loading IE Conditional Stylesheets in WordPress

Loading IE Conditional Stylesheets in WordPress

Most web developers are familiar with the IE conditional comments that allow you to load a stylesheet only in Internet Explorer. <!– [if lt IE 9]> <link href=”ie.css” rel=”stylesheet” type=”text/css”> <![endif]–> Many new WordPress developers tend to just hardcode these conditional comments directly into their […]