Remove Parent Theme Functions - this comes in handy when working in a premium theme that you might want to update with new versions, but you want to make changes to it in a child theme.
Resize images using aqua resizer. Aqua Resizer is a great little tool for when several images on a page must all be the same size. In a perfect world, we would just crop and resize in something like Photoshop, but the reality for a web developer is that not all of our clients have a photo editing tool and or have the skillset
Pull category for each unique post using the ID and replace spaces and special characters. This comes in handy when using isotope.js to filter projects or portfolio items by category. https://isotope.metafizzy.co/. Note, if a category is more than one word or has a special character such as an '&' then see the bottom example.
Using CMB2 to add repeating fields to a page or post - CMB2 has become one of my favorite plugins (even though it isn't officially known as a plugin). Using a repeatable field snippet from CMB2 is great for when you don't want to put a minimum or a maximum number of entry options for images, custom fields... I often use this in tandem with an Owl Carousel where I want my client to be able to add unlimited Testimonials, specials, gallery images, slider images...
/*class My_Walker_Nav_Menu extends Walker_Nav_Menu { function start_lvl( &$output, $depth = 0, $args = array()) { $indent = str_repeat("\t", $depth); $output .= "\n$indent<ul class=\"megamenu full-width\">\n"; } } $menuSettings = array( 'container' => 'div', 'menu_class' => 'jetmenu blue', //change this to whatever classes you need for your menu 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'items_wrap' => '<ul id="%1$s" class="%2$s list">%3$s</ul>', 'depth' => 3, //the number of submenus + 1 'walker' => new My_Walker_Nav_Menu() ); wp_nav_menu( $menuSettings ); //This script displays the menu. Please put it where you want it to display the menu.*/
// If the cart total is greater than 250 dollars and none of the excluded coupons are applied then the user should get free shipping or pick up in the shop. Remove flat Rate
// Here is the list of excluded coupons: $excluded_coupons = array('coupon1', 'coupon2', 'coupon3', 'coupon4', 'coupon5', 'coupon6', 'cooupon7', 'eight', 'nine', 'ten');
// If an excluded coupon is applied, then free shipping should no longer be an option. They should only get presented pickup in the shop or flat rate shipping.
// If the cart is under 250 they get flat rate shipping or free pickup in the shop.
// If a cart is over 250 and they use any other coupon, not in the excluded coupons array, the user should get free shipping or pickup in the shop.
// So the only time Flat Rate should get presented is when the cart is under 250 or the user has applied a coupon in the Excluded coupons array.
// free shipping should be an option to anyone with a cart over 250 and is not using an excluded coupon
It's commonly referred to as 'shorthand' or the Ternary Operator. $test = isset($_GET['something']) ? $_GET['something'] : ''; means if(isset($_GET['something'])) { $test = $_GET['something']; } else { $test = ''; } To break it down: $test = ... // assign variable isset(...) // test ? ... // if test is true, do ... (equivalent to if) : ... // otherwise... (equivalent to else) Or... // test --v if(isset(...)) { // if test is true, do ... (equivalent to ?) $test = // assign variable } else { // otherwise... (equivalent to :)