This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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 %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
dig mydomain.com | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
$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', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
// 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(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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``` |
NewerOlder