Skip to content

Instantly share code, notes, and snippets.

View AaronBowie's full-sized avatar

Aaron AaronBowie

View GitHub Profile
@dbjpanda
dbjpanda / deploy.php
Last active April 7, 2021 13:22
Deploy to Freemius
<?php
require_once getenv('HOME') . '/freemius-php-sdk/freemius/FreemiusBase.php';
require_once getenv('HOME') . '/freemius-php-sdk/freemius/Freemius.php';
define( 'FS__API_SCOPE', getenv( 'SCOPE' ) );
define( 'FS__API_DEV_ID', getenv( 'DEV_ID' ) );
define( 'FS__API_PUBLIC_KEY', getenv( 'PUBLIC_KEY' ) );
define( 'FS__API_SECRET_KEY', getenv('SECRET_KEY' ) );
define( 'FS__PLUGIN_ID', getenv('PLUGIN_ID' ) );
@bobbiejwilson
bobbiejwilson / functions_wc_dropdown.php
Last active March 13, 2018 16:00
Woocommerce variation dropdown with stock qty.
function wc_dropdown_variation_attribute_options( $args = array() ) {
global $product;
$variations = $product->get_available_variations();
$args = wp_parse_args( apply_filters( 'woocommerce_dropdown_variation_attribute_options_args', $args ), array(
'options' => false,
'attribute' => false,
'product' => false,
'selected' => false,
'name' => '',
@itzikbenh
itzikbenh / infinite-scroll.js
Last active June 14, 2017 14:41
This is related to this gist https://gist.github.com/itzikbenh/5cc5fb05b393a1516af70bc0fde3fa18 I'm experimenting with solutions to back button. Not ready yet
(function($) {
//Handles the infinite-scroll part and adds new content to sessionStorage so we can return user to the same position
//when he hits the back button
$(window).scroll(function() {
var url = $('.nav-links .next').attr('href');
if (url && $(window).scrollTop() > $(document).height() - $(window).height() - 150) {
//To avoid repeating calls we set the paginate container to hold only text and we remove the links.
//that way url variable would be empty, thus if statement would return false and not continure to the get call.
$('.navigation').text("Fetching more posts..."); //You can optionally load an icon-loader or something.
$(".loader").removeClass("hidden"); //Show the loader icon
@itzikbenh
itzikbenh / home.php
Last active April 5, 2020 09:30
Very simple infinite scroll in WordPress.
//Just a random file for loading your posts to see that the infinite scroll works.
<?php get_header(); ?>
<div class="col-md-6 col-md-offset-3">
<div class="post-container">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="page-header post">
<h1><?php the_title(); ?></h1>
<p><?php the_excerpt(); ?></p>
</div>
@feedmeastraycat
feedmeastraycat / woocommerce_order_actions.php
Last active March 9, 2016 11:09
Took me a couple of minutes to find how you add Order actions in WooCommerce so I thought I might write it down for someone else to Google find.
<?php
add_action('woocommerce_order_actions', 'my_woocommerce_order_actions', 10, 1);
function my_woocommerce_order_actions($actions) {
$actions['my_action'] = "Do my action";
return $actions;
}
add_action('woocommerce_order_action_my_action', 'do_my_action', 10, 1);
function do_my_action($order) {
// Do something here with the WooCommerce $order object