Author Archives: admin

About admin

Just another php developer trying to give something back to the community.

WordPress query posts my meta data

Description: On a WP powered site, if you add custom meta information, you might want to query the posts that have a particular meta information, like a custom post template. Solution: This is done very easy and safe using the … Continue reading

Posted in Wordpress | Tagged , , | 1 Comment

nginx index inside conditional location

Description: On a server that delivers multiple sites, I need to set up the location of a request depending on the host. For example I need to serve different text depending on the site language. Solution: The only problem here … Continue reading

Posted in Best practices, nginx, System | Tagged , | Leave a comment

Facebook Instant Articles feed not being crawled

Description: After installing in WordPress one of the Facebook Instant Articles plugins, the feed can be seen in browser at https://www.example.com/feed/fb/ but the Facebook publishing tool can’t crawl it. Solution: Of course this can be a due to a series … Continue reading

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

Check database tables size in Mb

Description: How can I check the size of my database tables and receive a human readaable result? This can be useful when deciding a storage architecture or a Cloud storage plan. Solution: From command line, go to mysql> terminal: SELECT … Continue reading

Posted in SQL | Tagged , | Leave a comment

WordPress proper query_posts with real results

Description: WordPress query_posts() function is pretty powerful, and easy to read out. However, you need to know what you’re querying for, as very often the results are not the expected ones. The specific post meta query is covered here. Solution: … Continue reading

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

Retrieve coordinates when click on image

Description: HTML forms allow the use of an image as a submit button, and the action triggers the send of the x and y coordinates of the click relative to the image size. However, why not take it to the … Continue reading

Posted in Javascript, Script | Tagged , , , | Leave a comment

Change button text value on HTML input type file

Description: Browsers render by default “Choose file” (or similar, depending on browsers and locale settings) when an input of type “file” is detected. Solution: Unfortunately there is no easy solution.  <input type=”file” name=”inputFile” id=”inputFile” /> This is pretty much all … Continue reading

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

Move WordPress database

Description: Moving an existing WordPress database is the easiest solution for changing website domain, duplicating content and so on, when we don’t want to lose posts, configurations and other meta data. However, this brings along also the connection to the … Continue reading

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

Grant privileges with MySql

Description: Grant privileges on a number of databases containing the same prefix. Solution: The tricky part is to take care of the right quotes to use, in particular the backtick ( ` ) Syntax is then as follows: GRANT ALL ON `wordpress_%`.* … Continue reading

Posted in Uncategorized | Leave a comment

Ignore file permissions with git

Description: Running a git status command shows modified files, with only changed file permissions. This can be due the IDE, for example PHPStorm is known for being a bit too nosy. diff –git a/myproject/index.php b/myproject/index.php old mode 100644 new mode 100755 … Continue reading

Posted in Version control | Tagged , , , , , | Leave a comment