This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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' ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' => '', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |