Custom post type is a great way to customize your WordPress and adding new taxonomies makes it even more powerful. All functionality comes with WordPress core but it can be difficult to specific posts on a custom taxonomy. The key in this is the new tax_query argument.
More
Get all posts on custom taxonomy slug with get_posts
March 27th, 2012 No Comments, Wordpress, by Joakim Ling.Passing an argument to setTimeout() in Javascript
March 15th, 2012 No Comments, Javascript, by Joakim Ling.
I came across a bit of complication when I for the first time needed to pass parameter to a function with setTimeout. The setTimeout() method calls a function or evaluates an expression after a specified number of milliseconds. It’s also supported in most browsers, brilliant tool if you want to create a javascript ticker.
More
Find path of a class name in PHP with ReflectionClass
March 5th, 2012 No Comments, PHP, by Joakim Ling.
To find out where a class is defined could be quite difficult is you are using frameworks you are not so familiar with. The ReflectionClass is a great tool to find out everything about your class and turn into objects.
More
All of your services have disk storage space allocated to you. When you fill your disk storage space, you will receive a notification message “Disk quota exceeded” when you try to perform operations, such as storing cache files or sending email. Even if you have free space left on your disk, doesn’t say that you have space to add new files.
More
How to use WordPress native Thickbox support in front end
February 21st, 2012 2 Comments, Wordpress, by Joakim Ling.
Thickbox is as jQuery plugin that WordPress use as it’s main popup window or modal view. It’s already built-in in WordPress so why not use that in front end. No need to download or import any extra files.
More
Make custom columns sortable in WordPress admin
February 15th, 2012 2 Comments, Wordpress, by Joakim Ling.
WordPress has had the ability since a long time ago to add custom fields to posts. Also called as meta-data. It’s also possible to add these values to your table list and make them sortable.
More
Not a lot of people knows that PHP supports SSH. I use it to execute remote commands, auto configure of web server configurations etc.
If you need to SSH to a server that only accepts a public key, the connection procedures get a bit more complicated.
More
For now this is only possible in Webkit and Mozilla browsers, the discussion about best implementation is still an ongoing project.
You’ll have to use 2 rules, as the standards for this is not been set yet.
More
For a long time we all have known that IPv4 limitations has come to an end. In the western world we are still heavily depending on IPv4 in a traditional way. However when it comes to younger and bigger Internet nations such as China and India, relaying on IPv4 is a disaster.
More
ssh-copy-id is a script that uses ssh to log into a remote machine and install your public key. I recently had to do this on a server that had ssh on a different port. Normally as you do “-p 6000″ but in this case a bit tricky
More
How to configure Auto Scaling with Amazon Web Services EC2 and ELB
February 8th, 2012 7 Comments, Linux, by Joakim Ling.
Using the Amazon Web services is a modern way to have your environment in the Cloud. It supports load balancing between your instances and thanks to Auto Scaling you’ll never need to pay for more than you use.
Basically the Auto Scaling launches additional instances to meet your demand, usually with help of a CPU alarm. Later removes them when not needed any more.
More
WP Easy Backup – Save all your custom files and database in one click
February 1st, 2012 3 Comments, Plugins, by Joakim Ling.
“WP Easy Backup” is a WordPress plugin that will create a database dump and zip all your media, theme and plugin files.
More
I wasted a good few hours trying to find a good solution on how to save an echoed string with sudo. I tried “sudo echo ..” and lots of different combinations before I made it work.
More
Get custom taxonomy name from post id with get_the_terms
December 9th, 2011 No Comments, Wordpress, by Joakim Ling.
If you’ve registered a custom taxonomy it’s a bit different to get data from than how you’d normally do for categories.
More
Update time and timezone in Linux from command prompt
December 2nd, 2011 1 Comment, Linux, by Joakim Ling.
The system time is often a symlink to the file /etc/localtime or the time zone file on the time zone directory. The definition for time zones can be written in short form as UTC±n (or GMT±n), where n is the offset in hours.
More
Regular expressions are an easy way to match or replace pieces of your content, but can be tricky if you are new to it. Here are a few examples to replace html tags.
More
Documentation: PCRE – Perl-compatible regular expressions
November 29th, 2011 1 Comment, PHP, by Joakim Ling.
The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl, with just a few differences. Some features that appeared in Python and PCRE before they appeared in Perl are also available using the Python syntax, there is some support for one or two .NET and Oniguruma syntax items, and there is an option for requesting some minor changes that give better JavaScript compatibility. from original documentation PHP PCRE
More
Rewrite/redirect URL tips using the .htaccess file
November 21st, 2011 2 Comments, Apache, by Joakim Ling.
This’s where you’ll work the magic to get the URL structure you want in the most optimized way possible. Some of the most common used rewrite usage are to shorten long URLs to short-friendly, protect your self against hotlinking, transforming dynamic ?page=title§ion=foo to friendly /title/foo/ or redirecting missing pages and much much more.
More
One of the most common used IDE for PHP developers is Zend Studio for Eclipse. Great for lazy programmers as that is consider being a plus nowadays. Have a reliable refactoring, testing, debugging and integrated with subversion is a must if you want to increase your development time. Well who has time to look for all those FIXME and TODO?
But I’ve noticed that sometimes I get performance issues, specially with typing lag. Being a fast typer there is nothing more annoying then a machine slowing you down.
More
In WordPress 2.9 custom post type was introduced, that opened a new world for many WordPress developers. I’ve come across a painful issue when it comes to removing the slug and not destroying the rewrite rules for other post types. This only concerns those who are using %postname% as permalink structure and want to add a custom post type so that the urls for them are in the same way as normal posts and pages: http://siteurl/%custom_post_type_title%/.
More