What ever you do is going to end up within the h1 tag, but this will keep it out of the menu etc. function personnel_filter($x) { $value = get_field(‘position’); $x = ‘<div class=”person-sub”>’ . $value . ‘</div><!–person-sub–>’ . $x; return $x; } function jma_person_title_cond($query) { global $wp_query; if ($query === $wp_query) { add_filter(‘the_title’, ‘personnel_filter’, 10, […]
WooCommerce Filters
Remove related products function jma_remove_related_products( $args ) { return array(); } add_filter(‘woocommerce_related_products_args’,’jma_remove_related_products’, 10); Redirect ‘add to cart’ button 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 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 […]
Solve HTTP Error in Media Library
Add to functions.php function change_graphic_lib($array) { return array( ‘WP_Image_Editor_GD’, ‘WP_Image_Editor_Imagick’ ); } add_filter( ‘wp_image_editors’, ‘change_graphic_lib’ );
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 […]
No Frills Pdf Button
function pdf_button_filter( $content ) { $pre_content = $post_content = ‘<a class=”pdf-button btn” href=”javascript:pdf_url=location.href;location.href=\’http://pdfmyurl.com?s=l&url=\’+escape(pdf_url)”>A pdf button!</a>’; $content = $pre_content . $content . $post_content; return $content; } function add_pdf_button_content(){//whatever template condition you want here //if(is_single())//for just posts //if(is_page())//for just pages if(is_singular( ‘park’ ))// park is the custom post type add_filter(‘the_content’, ‘pdf_button_filter’, 1); } add_action(‘template_redirect’, ‘add_pdf_button_content’);
Add Repeating Custom Field to Custom Post Type with Content Filter
function park_content_filter( $content ) { $new_content = ‘<div class=”camp-wrap clearfix”>’; $new_content .= ‘<div class=”item-title”>Camp</div>’; $new_content .= ‘<div class=”item-value”>Description</div>’; if(function_exists(‘get_field’) && get_field(‘camp’)){// camp is the field group while(has_sub_field(‘camp’)){ $new_content .= ‘<div class=”item-title”>’ . get_sub_field(‘camp_name’) . ‘</div>’; $new_content .= ‘<div class=”item-value”>’ . get_sub_field(‘camp_description’) . ‘</div>’; } } $new_content .= ‘</div><!–camp-wrap–>’; $content = $content . $new_content; return $content; […]