by Nick | Mar 18, 2016 | Code
Add this to your functions files to grey out ‘out of stock’ products in WooCommerce //grey out out of stock products function grey_out_variations_when_out_of_stock( $grey_out, $variation ) { if ( ! $variation->is_in_stock() ) return false; return true;...
by Nick | Jan 18, 2016 | Code
Add this to your functions file to add search to the main menu of your website. <?php //add search to menu function se_add_search_box_to_menu( $items, $args ) { if ( $args->theme_location === 'main' ) return $items . get_search_form(); return $items; }...
by Nick | Apr 30, 2014 | Code
This PHP allows you to use Shortcode in a WordPress template but also pull in a value from a custom field. This was used to add a shortcode for a slider to a specific page. <?php $slider = get_post_meta($post->ID, 'slider', true); echo...
by Nick | Mar 18, 2014 | Code
If you need to run a plugin which uses shortcodes in your template, this can be done with the following code. <?php echo do_shortcode("[shortcode]"); ?>
by Nick | Jul 7, 2013 | Code
Add this to your template where you want the menu to appear <?php $menu_slug = get_post_meta($post->ID,'menu',true); if(is_nav_menu($menu_slug)) { wp_nav_menu(array( 'menu' => $menu_slug )); } ?> Within each post or page add the custom field menu and set...
Recent Comments