This file contains hidden or 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 | |
// Change search function globally to search only post, page and portfolio post types | |
function prefix_limit_post_types_in_search( $query ) { | |
if ( $query->is_search ) { | |
$query->set( 'post_type', array( 'post','page', 'portfolio' ) ); | |
} | |
return $query; | |
} | |
add_filter( 'pre_get_posts', 'prefix_limit_post_types_in_search' ); | |
?> |
This file contains hidden or 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
/** | |
* Javacript for loading custom Google Analytics events | |
* | |
* @since 1.0.0 | |
*/ | |
(function($) { | |
// GA Docs for Social Interactions: | |
// https://developers.google.com/analytics/devguides/collection/analyticsjs/social-interactions |
This file contains hidden or 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
// Parses the url for query strings | |
function prefix_return_query_strings( url ) { | |
var urlParams; | |
var match, | |
pl = /\+/g, // Regex for replacing addition symbol with a space | |
search = /([^&=]+)=?([^&]*)/g, | |
decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); }, | |
query = url.search.substring(1); | |
urlParams = {}; | |
while (match = search.exec(query) ) { |
This file contains hidden or 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 | |
/** | |
* Sets up the Easy Post API Endpoints | |
* | |
* @package WP Theming | |
*/ | |
/** | |
* Sets up a JSON endpoint at /wp-json/easy-post/v1/rates/ |
This file contains hidden or 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 | |
/** | |
* Estimates the reading time for a given piece of $content. | |
* | |
* @param string $content Content to calculate read time for. | |
* @param int $wpm Estimated words per minute of reader. | |
* | |
* @returns int $time Esimated reading time. | |
*/ | |
function prefix_estimated_reading_time( $content = '', $wpm = 300 ) { |
This file contains hidden or 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 | |
/** | |
* WooCommerce code snippet that restricts which items can be added to cart: | |
* | |
* 1) The $trial_product should not be added to cart if existing items are in the cart. | |
* 2) Other products should not be added to cart if $trial_product is already in cart. | |
*/ | |
function example_cart_filtering( $passed_validation, $product_id ) { | |
// ID of the trial product |
This file contains hidden or 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 | |
/** | |
* When a trial product is purchased we create an order for a subscription product. | |
* | |
* This subscription order charges after 14 days if customer does not cancel. | |
*/ | |
class Nano_Trial_Subscription { | |
/** |
This file contains hidden or 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 | |
/** | |
* When a trial product is purchased we add a subscription product the order | |
* directly before order processing. | |
* | |
* This subscription order charges after 14 days if customer does not cancel. | |
*/ | |
class Nano_Trial_Subscription { |
This file contains hidden or 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
order deny,allow | |
deny from all | |
allow from 98.6.000.111 | |
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^index\.php$ - [L] | |
RewriteCond %{REQUEST_FILENAME} !-f |