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 | |
/* | |
* This checks whether either version of FooBox -- | |
* Free or Premium -- is activated. If not, it throws | |
* An admin notification, only for users who can | |
* activate plugins. | |
*/ | |
function fooboxnotpresent_admin_notice() { | |
if ( class_exists('Foobox_Free') || class_exists('fooboxV2')) { |
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 load_mc_iris() { | |
if (wp_script_is( 'iris', 'enqueued' )) { | |
return; // if it's already enqueued, don't enqueue it again. | |
} else { // since it's NOT enqueued, let's enqueue it | |
wp_enqueue_script( | |
'iris', //iris.js handle | |
admin_url( 'js/iris.min.js' ), //path to wordpress iris file |
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('get_image_tag_class', 'add_imagelens_frames', 0, 4); | |
function add_imagelens_frames($classes, $id) { | |
$singlelens = get_post_meta( $id, '_enable_lens', true ); | |
if ($singlelens === 'imagelens-single') { | |
return $classes . ' ' . $singlelens; | |
} else { |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 detect_plugin_activation( $plugin ) { | |
if( $plugin == 'path-to-my-plugin') { | |
wp_redirect("options-general.php?page=my-plugin-settings-page"); | |
exit; | |
} else {} | |
} | |
add_action( 'activated_plugin', 'detect_plugin_activation', 10, 2 ); |
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*="give-form-wrap"] { | |
text-align: center; | |
} | |
.give-total-wrap, | |
#give-final-total-wrap { | |
display: inline-block; | |
margin: 0 auto; | |
} |
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( | |
'orderby' => 'name', | |
'parent' => 0, | |
'order' => DESC | |
); | |
$categories = get_categories( $args ); | |
$curr_letter = ''; | |
foreach ( $categories as $category ) { | |
$this_letter = strtoupper(substr($category->name,0,1)); |
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
/* | |
* This code allows your posts to have a fallback featured image based on your category. | |
* It requires manual upload of the featured images. In this case it assumed /category-images to have | |
* been created in the root WP install directory. | |
* It is based on this tutorial at WPBeginner: | |
* http://www.wpbeginner.com/wp-themes/set-fallback-featured-image-based-post-category-wordpress/ | |
* The original tutorial assumed all categories have a featured image. | |
* This codes inserts a div (to be styled) when there is also no featured image for the category. | |
* Nathan Briggs was instrumental in implementation of the file_exists method. | |
*/ |
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 | |
/* | |
* This asks first for a Yoast SEO meta description, | |
* If that's not present, then it asks for the excerpt of the post, | |
* If that's not present, then it strips the content | |
* In this case, I have an excerpt length setting in the Customizer | |
* Both the excerpt and content stripping, also strip shortcodes | |
* @author Matt Cromwell <reachme@mattcromwell.com> | |
* @copyright Copyright (c) 2014, Matt Cromwell | |
* @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
add_filter( 'caldera_forms_autopopulate_options_post_value_field', 'givewp_customer_addon_purchases', 24, 2 ); | |
function givewp_customer_addon_purchases() | |
{ | |
$current_user = wp_get_current_user(); | |
$purchases = edd_get_users_purchases($current_user->user_email, 100, false, 'any'); | |
if ( $purchases ) { | |
foreach ($purchases as $purchase) { | |
$licenses = edd_software_licensing()->get_licenses_of_purchase( $purchase->ID ); |
OlderNewer