Skip to content

Instantly share code, notes, and snippets.

Taken from here https://code.tutsplus.com/tutorials/understanding-the-walker-class--wp-25401
```
class Walker_Simple_Example extends Walker {
// Set the properties of the element which give the ID of the current item and its parent
var $db_fields = array( 'parent' => 'parent_id', 'id' => 'object_id' );
// Displays start of a level. E.g '<ul>'
// @see Walker::start_lvl()
function start_lvl(&$output, $depth=0, $args=array()) {
## Working locally
https://www.shopify.com/partners/blog/95401862-3-simple-steps-for-setting-up-a-local-shopify-theme-development-environment
## Basics
### Conditional
```
{% if user.name == 'elvis' %}
Hey Elvis
{% endif %}
WP cron hooks are stored in the options table in an option named cron. WooCommerce likes to fill this over time until it is too big to write.
While not perhaps optimal, what I do is just empty it:
```
UPDATE wp_2_options SET option_value = '' WHERE option_name = 'cron'
```
Extract from unencrypted PFX
```
openssl pkcs12 -in [file.pfx] -out keys_out.txt
```
Extract from encrypted PFX
```
openssl pkcs12 -in [file.pfx] -out keys.pem -nodes
```
```
dig mydomain.com
```
```
$args = array(
'post__in' => $ids,
'post_type' => array(
'post',
'featured_item', // Include for its tag archive listing.
),
'numberposts' => -1,
'meta_key' => 'custom_post_date',
'orderby' => 'meta_value',
Ensure src attribute of video is empty. Then add something like this:
```
<script>
window.onload = function(){
document.getElementById("vidSrc").src = "mysrc.mp4";
document.getElementById("vid").load();
document.getElementById("vid").play();
};
</script>
```
// Get Product ID
$product->get_id(); (fixes the error: "Notice: id was called incorrectly. Product properties should not be accessed directly")
// Get Product General Info
$product->get_type();
$product->get_name();
$product->get_slug();
```php
/**
* Add form fields to Checkout
*/
add_filter('woocommerce_checkout_fields', 'wmco_woocommerce_checkout_fields');
function wmco_woocommerce_checkout_fields($fields){
$new_field['billing_org'] = [
'label' => __('Org no.', 'woocommerce'),
'placeholder' => _x('Org no.', 'placeholder', 'woocommerce'),
'required' => false,
Add to Htaccess:
```
php_flag display_startup_errors off
php_flag display_errors off
php_flag html_errors off
php_value docref_root 0
php_value docref_ext 0```