Skip to content

Instantly share code, notes, and snippets.

Avatar

Stephanie stephanieland352

  • Ocala, FL
View GitHub Profile
View image-upload-setting-field.php
// 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
View goals-archive.php
<?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 Oct 24, 2018
A cart link with drop down of woocommrce cart data
View cart_with_woocommerce_dropdown_info
<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 Oct 24, 2018
Display total sale per woocommerce product in wordpress
View display_total_sales_per_product.php
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 Oct 2, 2018
Woocommerce Categories loop with products
View functions.php
$args = array(
'type' => 'product',
'parent' => 0,
'orderby' => 'name',
'hide_empty' => false,
'hierarchical' => 1,
'exclude' => '',
'include' => '',
@stephanieland352
stephanieland352 / fancysearch.php
Created Oct 2, 2018
Woocommerce Ajax Typeahead Search
View fancysearch.php
<!-- 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 Feb 27, 2017
Woocommerce display total sales per product
View functions.php
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( "