WordPress – $wpdb->insert – MySQL NOW()

I believe the canonical approach is to use the WordPress current_time() function passing it ‘mysql’ as the first parameter to specify a mysql timestamp compatible format (the alternative is UNIX timestamp format) and ‘1’ as the second parameter to specify GMT time (default is local), like this: $data = array( ‘id’ => NULL, ‘order’ => … Read more

woocommerce get_woocommerce_currency_symbol()

Your code should work, which means the issue might be in the database. You can check these 2 functions:get_woocommerce_currency() and get_woocommerce_currency_symbol() from the WooCommerce docs that shows that you are using the functions correct. What is left is for you to start some troubleshooting steps to see what causes the error: What is get_option(‘woocommerce_currency’) returning? … Read more

How do I debug a WordPress plugin?

There’s this excellent Q&A at WordPress Stack Exchange, lots of knowledgeable folks explaining their debugging techniques: How do you debug plugins? In the Javascript arena you basically need <script>console.log(‘the value is’ + variable);</script>. And use Google Chrome inspector and/or Firebug. In PHP, it depends on where things are happening or where you want the output. … Read more

WordPress wp_title blank on index page

Here’s is what I read from Codex: If you are using a custom homepage with custom loops and stuff, you will have an empty wp_title. Here goes a neat hack to add the description/tagline at the wp_title place on homepage: <title><?php bloginfo(‘name’); ?> | <?php is_front_page() ? bloginfo(‘description’) : wp_title(”); ?></title> So use is_front_page() to … Read more

Can I host my wordpress blog on github pages as a static webpage

This website gives a good answer on how to do this: https://www.hywel.me/static/site/wordpress/2016/07/17/fast-free-static-website-with-wordpress-and-github-pages.html In short: Set-up GitHub pages. Install Simply static plugin into WordPress. Push the export from the plug-in back to your git repository and you are done!