Skip to content

Instantly share code, notes, and snippets.

@bekarice
bekarice / wp-change-one-page.php
Last active November 28, 2019 11:31
Apply code or styles to a single page in WordPress
/**
* Change styles applied to one page
*
* Uses 'wp' to run after WP class object so page content is available
*/
function sv_hide_header_footer_for_page() {
if( is_page( 2576 ) ) {
?> <style>
header#header,
@bekarice
bekarice / edit-woocommerce-checkout-template.php
Last active October 28, 2024 06:16
Add content and notices to the WooCommerce checkout - sample code
/**
* Each of these samples can be used - note that you should pick one rather than add them all.
*
* How to use WC notices: https://github.com/woothemes/woocommerce/blob/master/includes/wc-notice-functions.php#L96
* Tutorial: http://www.skyverge.com/blog/edit-woocommerce-templates/
**/
/**
* Add a content block after all notices, such as the login and coupon notices.
*
@bekarice
bekarice / wpspsc-create-lightbox-preview.php
Last active May 7, 2020 18:41
Make the product box images in WordPress Simple PayPal Shopping Cart lightbox previews instead
/**
* Let's make the product box images in WPSPSC lightbox previews instead
*
* The plugin is here: https://wordpress.org/plugins/wordpress-simple-paypal-shopping-cart
* Using this lightbox plugin: https://wordpress.org/plugins/responsive-lightbox/
*/
function make_wpspsc_thumbs_lightbox_previews( $thumbnail, $atts ) {
// Code Credit: http://stackoverflow.com/questions/19323324/how-to-get-image-src-attribute-value-from-php-string
@bekarice
bekarice / hide-edd-coupons.php
Last active November 10, 2020 17:01
Hide EDD Coupon fields and codes at checkout
/**
* Snippets to hide EDD coupon fields & codes during the checkout process - handy if you use URLs to apply discounts instead
* Tutorial: http://www.sellwithwp.com/easy-digital-downloads-hide-coupons/
*/
// Removes the field to enter a discount at checkout
remove_action( 'edd_checkout_form_top', 'edd_discount_field', -1 );
// Changes the discount code in the checkout summary to display "Discount applied - " instead of the code
@bekarice
bekarice / orders-export-2014_10_20_13_19_41.xml
Last active May 11, 2016 21:06
WooCommerce Customer / Order XML Export Suite Sample Export
<?xml version="1.0" encoding="UTF-8"?>
<Orders>
<Order>
<OrderId>892</OrderId>
<OrderNumber>#892</OrderNumber>
<OrderDate>2014-10-20 13:19:41</OrderDate>
<OrderStatus>completed</OrderStatus>
<BillingFirstName>Hank</BillingFirstName>
<BillingLastName>Schrader</BillingLastName>
<BillingFullName>Hank Schrader</BillingFullName>
@bekarice
bekarice / wc-change-return-to-shop-link.php
Last active August 8, 2023 19:30
Change WooCommerce return to shop URL
@bekarice
bekarice / wc-below-featured-image.php
Last active March 25, 2019 14:06
Add content below WooCommerce Featured image
@bekarice
bekarice / echo-wc-sku.php
Last active February 4, 2019 23:10
Print WC Product SKU
/**
* Echos the SKU for the product when used on a single product page
* Can optionally pass in the ID to echo the SKU for a product elsewhere
* Use [wc_sku] or [wc_sku id="ID"]
* Tutorial: http://www.skyverge.com/blog/output-woocommerce-sku/
**/
function skyverge_get_product_sku( $atts ) {
global $product;
@bekarice
bekarice / wc-sku-link.php
Last active February 4, 2019 23:10
Echo a link using the product SKU
@bekarice
bekarice / add-link-to-wc-short-desc.php
Last active February 4, 2019 23:10
Add Content that Includes the SKU after WC short description