Category: "General PHP"
I used Wordpress as the development framework for a mobile application project. Wordpress has a set of XMLPRC api for a very long time. Moreover, the mainstream in Mobile development is to use JSON as the communication format, rather than XML. JSON is smaller and easier to deserialize back to an object. Originally, I planned to use a third party plug-in for REST API and with my own code to build my own version REST API for my mobile application. Today, I checked my WordPress; It got an update for WordPress 4.7. After the updates, I found this version finally got an official REST API. That is great. I can build my code on top of that!
You can check this demo from Wordpress
If you want to have a new custom shortcode in WooCommerce, you can add the codes in wp-content\plug-ins\woocommerce\includes\class-wc-shortcode.php. That will works, however, that is not the best practice. Because if some one updated the woocomerce plug-ins, then your custom code will be overwritten. I suggest you write your plug-in, Then using:
Then you can have your own shortcode, then you can use global $woocommerce_loop; , that global variable to retrieve the data from woocommerce.
I used a lot of free wordpress template and plug-ins. They are good. But in some situations, especially, the templates and plug-ins are not from wordpress.org. They are from some random websites. You have to be very careful. You have to check them very carefully. I will do a code review for that.
There is a common technique, they will use. The page will detect the user agent string. If you use a normal browser, they will deliver a normal content. When the search indexing engine visit them, they will deliver the spammer content. To check that, you can use the fetch as google in Webmaster tools for checking. If you are a power user, you can use some browser plug-ins to change your agent user agent string to be a indexing engine.
Source:Open Clip Art Using Under Public Domain Attribution
I just moved a website to a new server. During the first test, I got an error :call to undefined function json_decode().
That is simple, because by default, my new server has not enable json module in PHP. The solution is going to cpanel to enable json in PHP.
I just got a new website built which is a Gantry template. I got some error, e.g. Fatal error: Out of memory. That is from Gantry's CSS LESS compiler. I tried to comment out the codes to by-pass compiler. It does not 100% work. Finally, I put a request to web host for increasing the buffer to 128MB. Then all works fine.
(Note that, I know you can use define function in php to increase your memory buffer, but some web hosts will not allow it.)