if(!function_exists(‘jma_yt_detect_shortcode’)){ function jma_yt_detect_shortcode( $needle = ”, $post_item = 0 ){ if($post_item){ if(is_object($post_item)) $post = $post_item; else $post = get_post($post_item); }else{ global $post; } if(is_array($needle)) $pattern = get_shortcode_regex($needle); elseif(is_string($needle)) $pattern = get_shortcode_regex(array($needle)); else $pattern = get_shortcode_regex(); preg_match_all( ‘/’. $pattern .’/s’, $post->post_content, $matches ); if(//if shortcode(s) to be searched for were passed and not found $return false […]
Left Tabs with Flyouts
Set shortcode (bootstrap) to pills: .tabs-left .tb-tabs-framed .tab-content { border-top-width: 1px; margin-left: 149px; } .tabs-left .nav-tabs, .tabs-left .nav-pills { width: 150px; float: left; } .tabs-left .nav-tabs>li, .tabs-left .nav-pills>li { border-left-width: 1px; float: none; border-top: solid 1px #ffffff; } .tabs-left .nav-pills>li { width: 110px; margin-left: 0; position: relative; -webkit-transition: width 0.3s; /* Safari */ transition: width […]
Pinwheel Image
The markup (using Jumpstart shortcode for bootstrap elements and putting over bg image in the builder) substitute <div class=”whatever”> for [html class=”whatever”] and </div> for [/html] . the html: [raw] [column size=”5/12″ wpautop=”false”] [html class=”inner left”]This is an example page. It’s different from a blog post because it wil[/html] [/column] [column size=”1/6″ wpautop=”true”] <!–Column 2…–> […]
Nivo Slider From ACF Gallery
Use this to create the html for the slider: function jma_nivo($input = array() ){ $defaults = array( ‘class’ => ”, ‘acf_field’ => ‘gallery’, ‘image_size’ => ‘tb_grid’, ‘thumb_size’ => ‘tb_thumb’, ‘post_id’ => ”, ‘image_ids’ => ”, ); foreach($defaults as $var => $default){ $args[$var] = isset($input[$var]) && $input[$var]? $input[$var]: $default; } extract($args); if(!$post_id){ global $post; $post_id = […]
Grid of Taxonomies
Some options to add a grid of taxonomy pages. The first doesn’t include pageing the second requires adding a second post type to hold the pages. // no pageing with this one function jma_series_grid ($atts){ ob_start(); extract( shortcode_atts( array( ), $atts ) ); $series_array = get_terms( ‘series’ ); foreach ($series_array as $series) {//get values from […]
WooCommerce MiniCart
//shortcode for mini-cart function jma_woo_minicart($atts){ ob_start(); global $woocommerce; echo ‘<a class=”cart-contents” href=”‘ . ‘ $woocommerce->cart->get_cart_url()’ . ‘” title=”View your shopping cart”>’; echo sprintf(_n(‘%d item’, ‘%d items’, $woocommerce->cart->cart_contents_count, ‘woothemes’), $woocommerce->cart->cart_contents_count) . ‘ – ‘ . $woocommerce->cart->get_cart_total() . ‘</a>’; $x = ob_get_contents(); ob_end_clean(); return $x; } add_shortcode(‘jma_woo_minicart’,’jma_woo_minicart’); // Ensure cart contents update when products are added to […]
Versatile html Shortcode Wrapper
Sometimes as I code a page I find it necessary to use some specific html to get the job done. the problem is that when I hand the site over to the client and they start editing in the Visual editor there is a danger that they will inadvertently over-write my html (which isn’t visible […]
Display Posts by Category [shortcode]
Suppose we want to display a list of post links in the sidebar that are in “child” categories of the “News” category (ie “Boating News” followed by its posts, “Fishing News” followed by its posts, in this case from the last 90 days because of the filter). We could include this code in functions.php: add_filter(‘widget_text’, […]