Skip to content

Instantly share code, notes, and snippets.

View stephanieland352's full-sized avatar

Stephanie stephanieland352

View GitHub Profile
@stephanieland352
stephanieland352 / image-upload-setting-field.php
Created April 26, 2019 20:00
Add image upload settings field
// Logos in media settings
add_action('admin_init', 'my_media_section');
function my_media_section() {
add_settings_section(
'theme_logo_settings_section', // Section ID
'Theme Logos', // Section Title
function(){
echo '<p>Add Logos </p>';
wp_enqueue_media();
}, // Callback
@stephanieland352
stephanieland352 / goals-archive.php
Created November 27, 2018 03:30
Goals Thermometer
<?php
global $wp_query;
$maincat = $wp_query->get_queried_object();
$cat_id = $maincat->term_id;
$goals = array(
'post_type' => 'product',
'post_status' => 'publish',
'ignore_sticky_posts' => 1,
'posts_per_page' => -1,
'orderby' => 'menu_order',
@stephanieland352
stephanieland352 / cart_with_woocommerce_dropdown_info
Created October 24, 2018 18:31
A cart link with drop down of woocommrce cart data
<div class="cart-wrap">
<?php global $woocommerce; ?>
<div class="cart_icon" href="<?php echo $woocommerce->cart->get_cart_url(); ?>">
@stephanieland352
stephanieland352 / display_total_sales_per_product.php
Last active October 24, 2018 18:25
Display total sale per woocommerce product in wordpress
function dw_product_totals() {
global $wpdb;
$post = get_post( $post_id );
$current_product = get_the_ID($post);
$order_items = apply_filters( 'woocommerce_reports_top_earners_order_items', $wpdb->get_results( "
@stephanieland352
stephanieland352 / functions.php
Created October 2, 2018 14:06
Woocommerce Categories loop with products
$args = array(
'type' => 'product',
'parent' => 0,
'orderby' => 'name',
'hide_empty' => false,
'hierarchical' => 1,
'exclude' => '',
'include' => '',
@stephanieland352
stephanieland352 / fancysearch.php
Created October 2, 2018 14:03
Woocommerce Ajax Typeahead Search
<!-- search -->
<form class="search" method="get" action="<?php echo get_permalink(get_option('woocommerce_shop_page_id')); ?>" role="search">
<input type="hidden" name="ts" value="true" />
<input class="search-input" type="search" name="s" placeholder="<?php _e( 'Search Our Products', 'html5blank' ); ?>" autocomplete="off" data-ajaxurl="<?php echo admin_url('admin-ajax.php'); ?>">
<div class="search-results"></div>
<button class="search-submit" type="submit" role="button"><i class="fa fa-search" aria-hidden="true"></i></button>
</form>
@stephanieland352
stephanieland352 / functions.php
Created February 27, 2017 20:29
Woocommerce display total sales per product
function dw_product_totals() {
global $wpdb;
$post = get_post( $post_id );
$current_product = get_the_ID($post);
$order_items = apply_filters( 'woocommerce_reports_top_earners_order_items', $wpdb->get_results( "