Resizing Shop Page Product Thumbnail Image

add_filter( ‘storefront_woocommerce_args’, ‘bbloomer_resize_storefront_images’ ); function bbloomer_resize_storefront_images( $args ) { $args[‘single_image_width’] = 1500; $args[‘thumbnail_image_width’] = 600; $args[‘gallery_thumbnail_image_width’] = 1500; return $args; }Continue reading

System: API endpoint for plugins

function register_review_list() { register_rest_route(‘review/v1’, ‘reviewList’, [ ‘methods’ => WP_REST_SERVER::READABLE, ‘callback’ => ‘review_list_results’ ]); } function review_list_results($data) { $results = []; // basic error handling if (false === isset($data[‘term’]) ) { return [ ‘error’ => ‘No soup for you…’ ]; }…Continue reading

WP Forms Modern Reviews

/** * Custom shortcode to display WPForms form entries in table view. * * Basic usage: [wpforms_entries_table id=”FORMID”]. * * Possible shortcode attributes: * id (required) Form ID of which to show entries. * user User ID, or “current” to…Continue reading

Redirect Pages

function afwerx_redirect() { if (isset($_SERVER[‘HTTPS’]) && ($_SERVER[‘HTTPS’] == ‘on’ || $_SERVER[‘HTTPS’] == 1) || isset($_SERVER[‘HTTP_X_FORWARDED_PROTO’]) && $_SERVER[‘HTTP_X_FORWARDED_PROTO’] == ‘https’) { $protocol = ‘https://’; } else { $protocol = ‘http://’; } $currenturl = $protocol . $_SERVER[‘HTTP_HOST’] . $_SERVER[‘REQUEST_URI’]; $currenturl_relative = wp_make_link_relative($currenturl);…Continue reading

Noindex Product Search Pages

add_filter( ‘aioseo_robots_meta’, ‘aioseo_filter_robots_meta’ ); function aioseo_filter_robots_meta( $attributes ) { if ( is_search() && ‘product’ === get_query_var(‘post_type’) ) { $attributes[‘index’] = “noindex”; }; return $attributes; }Continue reading

Add the Page Slug to Body Class

function wpcode_snippet_add_slug_body_class( $classes ) { global $post; if ( isset( $post ) ) { $classes[] = $post->post_type . ‘-‘ . $post->post_name; } return $classes; } add_filter( ‘body_class’, ‘wpcode_snippet_add_slug_body_class’ );Continue reading