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
// 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 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
/** | |
* | |
* Force http/s for images in WordPress | |
* | |
* Source: | |
* https://core.trac.wordpress.org/ticket/15928#comment:63 | |
* | |
* @param $url | |
* @param $post_id | |
* |
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
function wip_login_redirect( $url, $request, $user ){ | |
// Define referrer | |
$slug = $_SERVER["REQUEST_URI"]; | |
// Define slugs of any referrers you want here | |
// For example, if they page you want to target | |
// is www.testsite.com/hello-world | |
// you'll want this: | |
// $islogin = strpos($slug, 'hello-world'); | |
$islogin = strpos($slug, 'log-in'); |
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 | |
/** | |
* RSS2 Feed Template for displaying RSS2 Posts feed. | |
* Adds an offset of "1" to display all but most recent | |
* Full details at: https://wordimpress.com/anatomy-advanced-wordpress-blog-notification-email | |
* @package WordPress | |
*/ | |
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); | |
$more = 1; |
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 | |
/** | |
* Custom WordImpress RSS2 Feed | |
* Integrates Featured Image as "Enclosure" | |
* See http://www.rssboard.org/rss-2-0-1#ltenclosuregtSubelementOfLtitemgt | |
* for RSS 2.0 specs | |
* @package WordPress | |
*/ | |
header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); |
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
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 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 | |
/* | |
* 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 <[email protected]> | |
* @copyright Copyright (c) 2014, Matt Cromwell | |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
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 | |
/* | |
* Add "Formats" dropdown to TinyMCE Editor | |
*/ | |
function matt2015_mce_formats($buttons) { | |
array_unshift($buttons, 'styleselect'); | |
return $buttons; | |
} | |
add_filter('mce_buttons_2', 'matt2015_mce_formats'); |
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
div[class*="give-form-wrap"] { | |
text-align: center; | |
} | |
.give-total-wrap, | |
#give-final-total-wrap { | |
display: inline-block; | |
margin: 0 auto; | |
} |
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 | |
/* | |
* Dependent Plugin Activation/Deactivation | |
* | |
* Sources: | |
* 1. https://pippinsplugins.com/checking-dependent-plugin-active/ | |
* 2. http://10up.com/blog/2012/wordpress-plug-in-self-deactivation/ | |
* | |
*/ | |