Monthly Archives: April 2014

Query posts in WordPress

Description: Querying through the posts can be useful for creating special container pages. Returning the posts you require is only a matter of using the right attributes. Solution: A query in WordPress looks like a series of GET variables: query_posts(‘posts_per_page=-1&cat=’.7.’&orderby=title&order=ASC’) … Continue reading

Posted in Wordpress | Tagged , , , , , | Leave a comment

Secure copy files between hosts

Description: Use scp (secure copy) to copy data between different servers, from local or remote hosts. Solution: Syntax for secure copying is easy, you just need to provide the source and destination of the file/folder. Depending where you are copying to … Continue reading

Posted in Linux, Tools | Tagged , , , , | Leave a comment

Create symlink

Description: A symlink (or symbolik) link allows creating an alias for a file or folder in a different folder with a different name. This can come in handy for accessing special folders in the structure that don’t need to be … Continue reading

Posted in Linux, Tools | Tagged , , , | Leave a comment

Run PHP Compatibility checks for upgrading version

Description: In order to bring the PHP version up to date, we need to run compatibility test on our projects. Solution: The CodeSniffer tool that can be installed on each system gives us the most precise results. Follow the guide … Continue reading

Posted in Best practices, Linux, PhP | Tagged , , , , , | Leave a comment

Requirements for sending e-mails from PHP

Description: We need to send e-mails directly from a PHP script. Solution: First, in php.ini the smtp port should be set to 25, but this is usually by default. To locate your php.ini file in the server configuration you can use … Continue reading

Posted in Linux, PhP, Wordpress | Tagged , , , , , , | Leave a comment

substr() cuts in the middle of & symbol

Description: In “Read more” segments, you often need to cut the text to a length and add ‘…’ at the end. This can be a bit tricky when the limit falls on a special character. Solution: We can use mb_substr() … Continue reading

Posted in Best practices, PhP | Tagged , , , , | Leave a comment