0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | jQuery(document).ready(function($){ /* Put any theme-specific JS here... */ var $components = $('#content > .inner, .fixed-sidebar .fixed-sidebar-inner'); function equalizeHeights($selector) { var heights = new Array(); // Loop to get all element heights $selector.each(function() { var $this = $(this); // Need to let sizes be whatever they want so no overflow on resize $this.css('min-height', '0'); $this.css('max-height', 'none'); $this.css('height', 'auto'); // Then add size (no units) to array heights.push($this.innerHeight()); }); // Find max height of all elements var max = Math.max.apply( Math, heights ); // Set all heights to max height $selector.each(function() { if($(window).width() > 768) { $(this).css('min-height', max + 'px'); } }); } $(window).load(function() { // Fix heights on page load equalizeHeights($components); // Fix heights on window resize var iv = null; $(window).resize(function() { if(iv !== null) { window.clearTimeout(iv); } // Needs to be a timeout function so it doesn't fire every ms of resize iv = setTimeout(function() { equalizeHeights($components); }, 120); }); }); }); |
For more code ideas go to my GitHub gists:
https://gist.github.com/johnnya23
Supress Plugin Update Nag
0 1 2 3 4 5 6 7 8 | /* just add to main.php of indy plugin */ add_filter('site_transient_update_plugins', 'dd_remove_update_nag'); function dd_remove_update_nag($value) { unset($value->response[ plugin_basename(__FILE__) ]); return $value; } |
Complex Query Over-rides
0 1 2 3 4 5 6 7 8 9 10 11 12 13 | function jma_spout_args( $query, $args ) { if ( isset( $args['query'] ) && $args['query'] == 'spouts' ) { $query = array( 'post_type' => 'product', 'post__in' => array( 126,128 ) ); } return $query; } add_filter('themeblvd_posts_args', 'jma_spout_args', 10, 2); |
Multi column Lists
The CSS:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | .col-list-wrap { margin-bottom: 20px; } .col-list-wrap ul { margin-bottom: 0; float: left; width: 100%; } .col-list-wrap:before,/* adding clearfix */ .col-list-wrap:after { content: " "; display: table; } .col-list-wrap:after { clear: both; } @media(min-width:768px){ .two.col-list-wrap ul, .col-list-wrap ul { width:50%; } .three.col-list-wrap ul { width:33%; } .four.col-list-wrap ul { width:25%; } } |
The HTML:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <div class="two col-list-wrap"><!--or three or four--> <ul> <li>Dental exams and procedures</li> <li>Job coaching, resume building assistance, etc.</li> <li>Housing programs</li> <li>Senior resources</li> </ul> <ul> <li>Domestic violence support</li> <li>Social Security Disability Income or Social Security Income</li> <li>Free financial counseling and budgeting classes</li> <li>One Stop Re-Entry Center: support services for incarcerated individuals </li> </ul> </div> |
Malone Box
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | .malone-box, .malone-box input[type="submit"], .malone-box input[type="text"], .malone-box input[type="email"], .malone-box input[type="tel"] { border-bottom-right-radius: 20px; border-top-left-radius: 20px; } .malone-box { padding: 25px 30px 15px!important; } .malone-box p { margin-bottom: 0; } .malone-box { border: 2px solid #990000; } |
Replace Placehoders
0 1 2 3 4 5 6 7 8 9 10 11 | .list-wrap .placeholder {/* or .grid-wrap or .showcase-wrap or .pst-wrap (for all) */ background-image: url('./images/scales.png'); background-repeat: no-repeat; background-position: center center; background-color: transparent; opacity: 0.7; } .list-wrap .placeholder i { display:none } |
Rollover
Roll over image covers. Notice that overflow is hidden so if there is too much text the extra gets cut off (column 4). Be Careful when considering how it will behave responsively. [raw] [column size=”1/4″ wpautop=”false”] Lorem ipsum dolor sit amet [/column] [column size=”1/4″ wpautop=”false”] Lorem ipsum dolor sit amet, consectetuer adipiscing [/column] [column size=”1/4″ […]
WooCommerce Filters
Remove related products
0 1 2 3 4 5 | function jma_remove_related_products( $args ) { return array(); } add_filter('woocommerce_related_products_args','jma_remove_related_products', 10); |
Redirect ‘add to cart’ button
0 1 2 3 4 5 6 7 | function jma_redirect_add_to_cart() { global $woocommerce; $checkout_url = $woocommerce->cart->get_checkout_url();//get_cart_url(); for cart return $checkout_url; } add_filter ('add_to_cart_redirect', 'jma_redirect_add_to_cart'); |
Redirect ‘back to shop’ button
0 1 2 3 4 5 | function jma_return_to_shop_redirect() { return get_permalink(682); } add_filter( 'woocommerce_return_to_shop_redirect', 'jma_return_to_shop_redirect' ); |
Turn off Themeblvd Woo Images (re-enable woo image size options)
0 1 2 | add_filter('themeblvd_woocommerce_images', '__return_false'); |
Add content to customer emails
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | Function jma_email_before_order_table($order, $sent_to_admin){ $items = $order->get_items(); foreach($items as $item){ $jma_item_list[] = $item['item_meta']['_product_id'][0];//create an array lising item ids in this woocommerce order } if(array_intersect(get_pro_cat_ids('minisites'), $jma_item_list)){/* 21,199 is minisite purchase 80*/ ?> <div style="padding: 10px; border: solid 1px #cc0200; margin-bottom: 15px"> <h3 style="margin: 0!important">Click the button below to access your MiniSite Construction Form Instructions</h3> <span style="font-size:10px">(disregard if you have already completed this form)</span><br/> <a style="display: inline-block; padding: 5px 10px; margin: 5px auto; color: #ffffff; background: #005389; text-decoration: none; font-weight:bold" href="<?php echo get_permalink(169) ?>"><?php echo get_the_title( 169 ); ?></a> </div> <?php } if(in_array(101, $jma_item_list)){/* 101 dns help addon purchase*/ ?> <div style="padding: 10px; border: solid 1px #cc0200; margin-bottom: 15px"> <h3 style="margin: 0!important">Click the button below to access your DNS Help Form</h3> <span style="font-size:10px">(disregard if you have already completed this form)</span><br/> <a style="display: inline-block; padding: 5px 10px; margin: 5px auto; color: #ffffff; background: #005389; text-decoration: none; font-weight:bold" href="<?php echo get_permalink(88) ?>"><?php echo get_the_title( 88 ); ?></a> </div> <?php } if(in_array(99, $jma_item_list)){/* 99 header design addon purchase*/ ?> <div style="padding: 10px; border: solid 1px #cc0200; margin-bottom: 15px"> <h3 style="margin: 0!important">Click the button below to access your Header Design Form</h3> <span style="font-size:10px">(disregard if you have already completed this form)</span><br/> <a style="display: inline-block; padding: 5px 10px; margin: 5px auto; color: #ffffff; background: #005389; text-decoration: none; font-weight:bold" href="<?php echo get_permalink(170) ?>"><?php echo get_the_title( 170 ); ?></a> </div> <?php } if(in_array(97, $jma_item_list)){/* 97 newsletter popup addon purchase*/ ?> <div style="padding: 10px; border: solid 1px #cc0200; margin-bottom: 15px"> <h3 style="margin: 0!important">Click the button below to access your Popup Newsletter Form</h3> <span style="font-size:10px">(disregard if you have already completed this form)</span><br/> <a style="display: inline-block; padding: 5px 10px; margin: 5px auto; color: #ffffff; background: #005389; text-decoration: none; font-weight:bold" href="<?php echo get_permalink(171) ?>"><?php echo get_the_title( 171 ); ?></a> </div> <?php } ?> <?php } add_action('woocommerce_email_before_order_table', 'jma_email_before_order_table', 10, 2); |
helper for above function
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | /* helper - * function get_pro_cat_ids * returns an array of ids for products in category $catslug * @param string $catslug slug of the category in question * * return array of product id (or false of failure) * * */ function get_pro_cat_ids($catslug){ $args = array( 'post_type' => 'product', 'product_cat' => $catslug, 'posts_per_page' => -1, ); $minisites = get_posts( $args ); if(count($minisites)){ foreach($minisites as $minisite){ $return[] = $minisite->ID; } }else{ $return[] = 'empty'; } return $return; } |
Remove/edit tabs (user new callback to edit tab content)
0 1 2 3 4 5 6 7 8 9 10 11 12 | function jma_remove_woo_product_tabs( $tabs ) { echo '<pre>'; print_r($tabs);echo '</pre>'; unset( $tabs['description'] ); // Remove the description tab unset( $tabs['reviews'] ); // Remove the reviews tab unset( $tabs['additional_information'] ); // Remove the additional information tab return $tabs; } function jma_manage_woo_content(){ add_filter( 'woocommerce_product_tabs', 'jma_remove_woo_product_tabs', 98 ); } add_action('template_redirect', 'jma_manage_woo_content'); |
print_r on $tabs array
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | Array ( [description] => Array ( [title] => Description [priority] => 10 [callback] => woocommerce_product_description_tab ) [reviews] => Array ( [title] => Reviews (1) [priority] => 30 [callback] => comments_template ) ) |
Hide Empty […]
Menu Top “Tags”
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | /* tag effect at top of dropdown menus */ .tb-primary-menu > .menu-item > .sub-menu > li:first-child:before, .tb-primary-menu > .menu-item > .sf-mega:before { content: ""; position: absolute; top: -11px; left: 15px; width: 0px; height: 0px; border-style: solid; border-width: 0 11px 11px 11px; border-color: transparent transparent #ff4891 transparent;/* border color*/ } .tb-primary-menu > .menu-item > .sub-menu > li:first-child:after, .tb-primary-menu > .menu-item > .sf-mega:after { content: ""; position: absolute; top: -10px; left: 16px; width: 0px; height: 0px; border-style: solid; border-width: 0 10px 10px 10px; border-color: transparent transparent #ffffff transparent;/* background color*/ -moz-transition: all .25s ease-out; -webkit-transition: all .25s ease-out; transition: all .25s ease-out; } .tb-primary-menu > .menu-item > .sub-menu.reverse > li:first-child:before { left: auto; right: 15px;/*when the far right item reverses against the edge of the page*/ } .tb-primary-menu > .menu-item > .sub-menu.reverse > li:first-child:after { left: auto; right: 16px;/*when the far right item reverses against the edge of the page*/ } .tb-primary-menu > .menu-item > .sub-menu > li:first-child:hover:after, .tb-primary-menu > .menu-item > .sub-menu > li.current-menu-parent:first-child:hover:after, .tb-primary-menu > .menu-item > .sub-menu > li.current-menu-ancestor:first-child:hover:after { border-color: transparent transparent #ff4891 transparent;/* hover background */ } .tb-primary-menu > .menu-item > .sub-menu > li.current-menu-item:first-child:after, .tb-primary-menu > .menu-item > .sub-menu > li.current-menu-parent:first-child:after, .tb-primary-menu > .menu-item > .sub-menu > li.current-menu-ancestor:first-child:after, .tb-primary-menu > .menu-item > .sub-menu > li.current-menu-item:first-child:hover:after { border-color: transparent transparent #ffcf00 transparent;/* active background */ } .tb-primary-menu > #menu-item-673 .sf-mega:before {/* manually reposition megas */ left: auto; right: 430px; } .tb-primary-menu > #menu-item-673 .sf-mega:after { left: auto; right: 431px; } |