Puddinq.com sharing knowledge

Puddinq.com - blog

Checkout: custom date field

In this situation we want a custom field on checkout which has a jQuery Date selector: /** * enqueue jquery datepicker script * * If is not admin (backend) and the page is * woocommerce checkout add the field */

Checkout: give a discount for local pickup

I had to add a discount for local pickup and at first this looked easy. You can set the costs to be a negative amount. But if the subtotal for the order was smaller then the discount, they got the order for free. So I wanted the discount only if the order subtotal was more […]

One stop redirect https and www

If you want a redirect to the www version and a redirect to the https version of your blog, you might add rules to redirect those situations. On any pageload test this kan be punished if it detects tworedirect (both to www and https). To be save time and score, do both redirects in one […]

Copyright notice with current year

This line shows a copyright notice with the current year. Add it in your WordPress theme template somwhere. echo “<span id=’copyright’> Copyright &copy; ” . date(‘Y’) . ” PUDDINQ</span>”;

Autologin for wordpress

At one site I have a custom role that can only view the orders. The owner wants some users to hav access without a password. Yes this story gets dumber.. He wants to give access by clicking a link. The basic script offered to autologin are hooked in to ‘plugins_loaded’ or ‘wp’. Both these hooks […]

Excel csv - snippet

This function writes a csv file to the folder it is run in.

Strip shortcodes from content

make shortcodes show / not work $content = str_replace( ‘]]>’, ‘]]&gt;’, $post->post_content );

HTML to image

je hebt nodig html2canvas en canvas2image

Debug your custom code

One thing is to do quality checks, but if you wite your code in a certain way, it can check itself. In your wp-config