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_filter('the_content', 'hjs_insert_content_after_chars_words'); | |
function hjs_insert_content_after_chars_words($content) { | |
// only do this if post is longer than 1000 characters | |
$enable_length = 1500; | |
// insert after the first </p> after 500 characters | |
$after_character = 1500; | |
if (is_single() && strlen($content) > $enable_length) { | |
$before_content = substr($content, 0, $after_character); | |
$after_content = substr($content, $after_character); |
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 | |
/** | |
* Recurring Events | |
* | |
* @package BE-Events-Calendar | |
* @since 1.0.0 | |
* @link https://github.com/billerickson/BE-Events-Calendar | |
* @author Bill Erickson <bill@billerickson.net> | |
* @copyright Copyright (c) 2014, Bill Erickson | |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
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 | |
// Returns subtotal price ($5.00) | |
$cart_subtotal = WC()->cart->get_cart_subtotal(); | |
// Returns subtotal number value (5) | |
$cart_subtotal = WC()->cart->subtotal; | |
/*======================================== | |
Single 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
<?php | |
// Adds a custom rule type. | |
add_filter( 'acf/location/rule_types', function( $choices ){ | |
$choices[ __("Other",'acf') ]['wc_prod_attr'] = 'WC Product Attribute'; | |
return $choices; | |
} ); | |
// Adds custom rule values. | |
add_filter( 'acf/location/rule_values/wc_prod_attr', function( $choices ){ |
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 | |
//Insert ads after second paragraph of single post content. | |
add_filter( 'the_content', 'prefix_insert_post_ads' ); | |
function prefix_insert_post_ads( $content ) { | |
$ad_code = '<div>Ads code goes here</div>'; | |
if ( is_single() && ! is_admin() ) { | |
return prefix_insert_after_paragraph( $ad_code, 2, $content ); | |
} | |
return $content; | |
} |
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
jQuery(document).ready(function($) { | |
$('.popup-gallery').magnificPopup({ | |
delegate: 'a', | |
type: 'image', | |
tLoading: 'Loading image #%curr%...', | |
mainClass: 'mfp-img-mobile', | |
gallery: { | |
enabled: true, | |
navigateByImgClick: true, | |
preload: [0,1] // Will preload 0 - before current, and 1 after the current image |
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
/* Woocommerce Styles */ | |
/* | |
A couple things to note... | |
1. This code was written very specifically for my base child theme so it might not work out of the box with every theme. | |
I have it here mostly to share with anyone who might be looking to do the same thing I was. | |
2. I generally add my WooCommerce CSS overrides to a custom-woo.css file then use wp_enqueue_style() to call it | |
so that it enqueues after the default WooCommerce Stylesheets |
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
/* globals FWP */ | |
/** | |
* JavaScript for FacetWP Infinite Scroll | |
*/ | |
( function( $ ) { | |
'use-strict'; | |
var throttleTimer = null; | |
var throttleDelay = 100; |
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 filters for Form ID 8 | |
add_filter( 'gform_pre_render_8', 'populate_posts' ); | |
add_filter( 'gform_pre_validation_8', 'populate_posts' ); | |
add_filter( 'gform_pre_submission_filter_8', 'populate_posts' ); | |
add_filter( 'gform_admin_pre_render_8', 'populate_posts' ); | |
function populate_posts( $form ) { | |
// Loop through each field searching for any "select" field with the class "populate-affs" |
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_filter( 'gform_field_value_time', function() { | |
return date( 'G.i', current_time( 'timestamp' ) ); | |
} ); |
NewerOlder