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
/** | |
* Optimize WooCommerce Scripts | |
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages. | |
*/ | |
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 ); | |
function child_manage_woocommerce_styles() { | |
//remove generator meta tag | |
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) ); |
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 | |
$args = array( | |
'posts_per_page' => 7, | |
'post_type' => 'product', | |
'product_cat' => 'home-featured', | |
'meta_key' => 'home_featured_order', | |
'orderby' => 'meta_value_num', | |
'order' => 'DESC' | |
); |
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
/** | |
* Plugin Name: Gravity Forms: Move Progress Bar to Bottom of Form | |
* Plugin URI: http://www.n7studios.co.uk | |
* Version: 1.0.1 | |
* Author: n7 Studios | |
* Author URI: http://www.n7studios.co.uk | |
* Description: Moves the progress bar from the top to the bottom of the Gravity Form. The Start Paging section of the form MUST have a CSS class = progress-bar-bottom | |
*/ | |
/** |
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 | |
/** | |
* Custom Loop Add to Cart. | |
* | |
* Template with quantity and ajax. | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly. | |
global $product; |
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
<div class="collection__main"> | |
<!-- COLLECTION SIDEBAR --> | |
{%- capture categories -%} | |
{%- for tag in collections[collection.handle].tags -%} | |
{%- if tag contains 'categories' -%} | |
{%- assign tag_patterns = tag | split: '_' -%} | |
<li class="collection-sidebar__filter-item main-filter" data-tag="{{ tag | handle }}">{{ tag_patterns[1] }}</li> | |
{%- endif -%} | |
{%- endfor -%} |
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
add_action( 'wp_enqueue_scripts', 'pt_like_it_scripts' ); | |
function pt_like_it_scripts() { | |
if( is_single() ) { | |
wp_enqueue_style( 'like-it', trailingslashit( plugin_dir_url( __FILE__ ) ).'css/like-it.css' ); | |
if (!wp_script_is( 'jquery', 'enqueued' )) { | |
wp_enqueue_script( 'jquery' );// Comment this line if you theme has already loaded jQuery | |
} | |
wp_enqueue_script( 'like-it', trailingslashit( plugin_dir_url( __FILE__ ) ).'js/like-it.js', array('jquery'), '1.0', true ); |
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 | |
/* Gravity Forms Image Validation ~~~~> */ | |
/* Add to functions.php and add a css class to the input, abp-image herein */ | |
function ter_limit_profile_image_size($validation_result){ | |
$form = $validation_result['form']; | |
foreach($form['fields'] as &$field){ | |
if(strpos($field['cssClass'],'abp-image') === false ) continue; | |
$is_hidden = RGFormsModel::is_field_hidden($form, $field, array()); | |
if($is_hidden) continue; | |
$input_name = 'input_' . $field['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
<?php | |
public function give_user_subscription( $product, $user_id, $note = '' ){ | |
// First make sure all required functions and classes exist | |
if( ! function_exists( 'wc_create_order' ) || ! function_exists( 'wcs_create_subscription' ) || ! class_exists( 'WC_Subscriptions_Product' ) ){ | |
return false; | |
} | |
$order = wc_create_order( array( 'customer_id' => $user_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
<?php | |
function yanco_has_active_subscription( $user_id = '' ) { | |
if( function_exists( 'wcs_user_has_subscription' ) ) { | |
// When a $user_id is not specified, get the current user Id | |
if( '' == $user_id && is_user_logged_in() ) { | |
$user_id = get_current_user_id(); | |
} | |
// User not logged in we return false |
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 | |
/** | |
* Post URL list | |
*/ | |
if (!function_exists('prefix_get_all_posts_url')) { | |
function prefix_get_all_posts_url($posttype = 'post') { | |
$args = array( | |
'post_type' => $posttype, | |
'post_status' => 'publish', |