Skip to content

Instantly share code, notes, and snippets.

View fearlex's full-sized avatar
🎯
Focused

Arleys Resco fearlex

🎯
Focused
View GitHub Profile
@bhubbard
bhubbard / wp-config.php
Last active March 10, 2019 13:54
A Custom Template for wp-config.php.
<?php
################################################################################
// Custom WP-CONFIG Template.
################################################################################
################################################################################
// For Quick Client Reference
################################################################################
// Client Name:
// Salesforce URL:
@schikulski
schikulski / wp-config.php
Created August 7, 2013 11:45
wp-config.php
<?php
// ===================================================
// Load database info and local development parameters
// ===================================================
if ( file_exists( dirname( __FILE__ ) . '/wp-config-local.php' ) ) {
define( 'WP_LOCAL_DEV', true );
define('WP_DEBUG', true);
require ('wp-config-local.php');
} elseif (file_exists(dirname(__FILE__) . '/wp-config-playground.php')) {
@webaware
webaware / add-to-cart.php
Last active October 9, 2024 00:33 — forked from mikejolley/functions.php
WooCommerce purchase page add-to-cart with quantity and AJAX, by customising the add-to-cart template in the WooCommerce loop. See blog post for details: http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/
<?php
/**
* Loop Add to Cart -- with quantity and AJAX
* requires associated JavaScript file qty-add-to-cart.js
*
* @link http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/
* @link https://gist.github.com/mikejolley/2793710/
*/
// add this file to folder "woocommerce/loop" inside theme
@webaware
webaware / gist:6260468
Last active October 28, 2024 06:19
WooCommerce purchase page add-to-cart with quantity and AJAX, without customising any templates. See blog post for details: http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/
<?php
/**
* start the customisation
*/
function custom_woo_before_shop_link() {
add_filter('woocommerce_loop_add_to_cart_link', 'custom_woo_loop_add_to_cart_link', 10, 2);
add_action('woocommerce_after_shop_loop', 'custom_woo_after_shop_loop');
}
add_action('woocommerce_before_shop_loop', 'custom_woo_before_shop_link');
@thenbrent
thenbrent / subscriptions-shortcode-examples.php
Last active March 10, 2019 14:07
Example usage for the [subscriptions] shortcode
[subscriptions]
[subscriptions user_id="33"]
[subscriptions status="all"]
[subscriptions user_id="42" status="all"]
@alana-mullen
alana-mullen / Detect the last post in the WordPress loop
Last active May 29, 2023 16:50
Detect the last post in the WordPress loop
<?php if (($wp_query->current_post +1) == ($wp_query->post_count)) {
echo 'This is the last post';
} ?>
<?php if (($wp_query->current_post +1) != ($wp_query->post_count)) {
echo 'This is the not the last post';
} ?>
@jwebcat
jwebcat / auto-coupon-woo.php
Created January 24, 2014 08:20
Automatically apply coupon to cart WooCommerce
add_action( 'woocommerce_before_cart', 'apply_matched_coupons' );
function apply_matched_coupons() {
global $woocommerce;
$get1 = 'getonech'; // your coupon code here
$get2 = 'gettwoch'; // your coupon code here
$get3 = 'getthreech'; // your coupon code here
$get4 = 'getfourch'; // your coupon code here
$get5 = 'getfivech'; // your coupon code here
@jjmu15
jjmu15 / in_viewport.js
Created January 27, 2014 10:19
check if element is in viewport - vanilla JS. Use by adding a “scroll” event listener to the window and then calling isInViewport().
// Determine if an element is in the visible viewport
function isInViewport(element) {
var rect = element.getBoundingClientRect();
var html = document.documentElement;
return (
rect.top >= 0 &&
rect.left >= 0 &&
rect.bottom <= (window.innerHeight || html.clientHeight) &&
rect.right <= (window.innerWidth || html.clientWidth)
);
@srikat
srikat / functions.php
Last active October 6, 2016 19:17
Using Waypoints Sticky Elements to fix elements to top of page upon scrolling in WordPress. http://sridharkatakam.com/using-waypoints-sticky-elements-fix-elements-top-page-upon-scrolling-wordpress/
add_action( 'wp_enqueue_scripts', 'stick_elements' );
function stick_elements() {
wp_enqueue_script( 'waypoints', get_stylesheet_directory_uri() . '/js/waypoints.min.js', array( 'jquery' ), '1.0.0' );
wp_enqueue_script( 'waypoints-sticky', get_stylesheet_directory_uri() .'/js/waypoints-sticky.min.js' , array( 'waypoints' ), '1.0.0' );
wp_enqueue_script( 'waypoints-sticky-init', get_stylesheet_directory_uri() .'/js/waypoints-sticky-init.js' , array( 'waypoints-sticky' ), '1.0.0' );
}
@thenbrent
thenbrent / wcs-do-not-update-role.php
Created February 7, 2014 19:31
A simple plugin to stop WooCommerce Subscriptions from changing users' roles.
<?php
/**
* Plugin Name: Stop WooCommerce Subscriptions Changing a User's Role
* Plugin URI:
* Description:
* Author: Brent Shepherd
* Author URI:
* Version: 1.0
*/