Skip to content

Instantly share code, notes, and snippets.

View seb86's full-sized avatar
🚀

Sébastien Dumont seb86

🚀
View GitHub Profile
<?php
/*
Plugin Name: Pug Bomb API Endpoint
Description: Adds an API endpoint at /api/pugs/$n_pugs
Version: 0.1
Author: Brian Fegter
Author URL: http://coderrr.com
*/
class Pugs_API_Endpoint{
<?php
/**
* Milestone Sale Alerts
* Be notified when a specific download is sold X times.
*/
function sumobi_edd_milestone_sales_alert( $purchase_id ) {
// ID of download to check
$download_id = 8;
<?php
function sumobi_edd_purchase_link_show_featured_image( $download_id ) {
echo get_the_post_thumbnail( $download_id, 'thumbnail' );
}
add_action( 'edd_purchase_link_top', 'sumobi_edd_purchase_link_show_featured_image' );
<?php
function sumobi_edd_terms_agreement() {
global $edd_options;
if ( isset( $edd_options['show_agree_to_terms'] ) ) {
?>
<fieldset id="edd_terms_agreement">
<div id="edd_terms">
<?php
do_action( 'edd_before_terms' );
@seb86
seb86 / gist:948c792892741eaa3f90
Created February 10, 2015 18:48
WordPress Plugin: Latest Apple Movie Trailers - Shortcode
[apple_trailers]
@seb86
seb86 / the-plugin-header.php
Last active August 29, 2015 14:15
The Plugin Header
<?php
/*
* Plugin Name: Beautiful Car Collection
* Plugin URI: http://www.sebastiendumont.com/beautiful-car-collection
* Description: List your collection of standard, tuned or custom cars with full details along with beautiful photos taken of your cars.
* Version: 1.0.0
* Author: Sébastien Dumont
* Author URI: http://www.sebastiendumont.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
@seb86
seb86 / gist:1baa022ffa01be1d8f88
Created March 9, 2016 17:48 — forked from latheesan-k/gist:3490cb6ab522ca87f535
Parse git logs into array in PHP
<?php
// Change To Repo Directory
chdir("/full/path/to/repo");
// Load Last 10 Git Logs
$git_history = [];
$git_logs = [];
exec("git log -10", $git_logs);
@seb86
seb86 / woocommerce_products_sold_single_product.php
Created May 17, 2016 18:14 — forked from kloon/woocommerce_products_sold_single_product.php
WooCommerce display number of products sold on single product page
<?php
add_action( 'woocommerce_single_product_summary', 'wc_product_sold_count', 11 );
function wc_product_sold_count() {
global $product;
$units_sold = get_post_meta( $product->id, 'total_sales', true );
echo '<p>' . sprintf( __( 'Units Sold: %s', 'woocommerce' ), $units_sold ) . '</p>';
}
?>
@seb86
seb86 / gist:d7a16fb67a99e99230221762045f7d90
Last active July 20, 2016 17:22
Gets the shipping cost for the product from the assigned shipping class
/**
* Returns the shipping cost from the shipping class assigned to the product.
*
* @param object $product
* @return string
*/
function get_shipping_cost( $product ) {
$shipping_method = apply_filters( 'woocommerce_default_single_product_shipping_method', 'flat_rate' );
$shipping = new WC_Shipping();
<?
// <readme>
/*
This is a lite version of Olark's and Intercom's functionality (without the chat part).
It lets you get feedback from users on your site to your email.
And you won't have to rely on another company anymore!
#killyourdependencies