Skip to content

Instantly share code, notes, and snippets.

View bamadesigner's full-sized avatar

Rachel Cherry bamadesigner

View GitHub Profile
@bamadesigner
bamadesigner / uncheckCheckboxes.js
Last active September 12, 2022 18:10
Uncheck all checkboxes
/**
* I was a tad agitated when I realized Twitter had auto-added
* 500+ interests to some weird list in my profile. Manually
* unchecking all of the boxes would've taken forever.
*
* https://twitter.com/settings/your_twitter_data/twitter_interests
*
* I wrote this script to help me auto-uncheck the
* boxes cause ain't nobody got time for that.
*
@bamadesigner
bamadesigner / functions.php
Last active April 22, 2019 03:20
Custom functions used for WP All Import of articles
<?php
function article_get_header_regex( $level ) {
$level = (int) $level;
return '/^\<h' . $level . '[^\>]*\>(.*)\<\/?h' . $level . '\>/i';
}
function article_get_end_of_url( $url ) {
// Remove trailing "/".
$last_chr = substr( $url, -1 );
@bamadesigner
bamadesigner / siteimprove.html
Created April 17, 2019 14:51
Siteimprove side buttons in WordPress plugin
<div class="si-toggle-container si-pos-side si-pos-east">
<div class="si-drag-container si-pos-side si-pos-east">
<div class="si-drag-box si-pos-side si-pos-east">
<div class="si-drag-dots si-pos-side si-pos-east"></div>
</div>
</div>
<div class="si-boxes-container si-pos-side si-pos-east">
@bamadesigner
bamadesigner / plugin.php
Created February 28, 2016 03:05
How to see the data without sending a test Slack
//Rock the Slackbot Customizations
add_filter( 'rock_the_slackbot_notification', 'edd_sales_slack_notification', 10, 3 );
function edd_sales_slack_notification( $notification, $notification_event, $event_args ) {
echo "<pre>";
print_r( $notification );
echo "</pre>";
exit;
// Change the pieces
@bamadesigner
bamadesigner / api-wp-query.php
Last active February 14, 2016 17:51
A method for detecting when WP_Query is being run for a REST API call.
<?php
/**
* Filter allowed query vars for the REST API.
*
* This filter allows you to add or remove query vars from the final allowed
* list for all requests, including unauthenticated ones. To alter the
* vars for editors only, {@see rest_private_query_vars}.
*
* @param array {
@bamadesigner
bamadesigner / plugin.php
Created November 29, 2015 21:13 — forked from mathetos/plugin.php
Dependent Plugin Activation/Deactivation and Alert
<?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/
*
*/
@bamadesigner
bamadesigner / shortcodes-remove-wpautop.php
Last active August 29, 2015 14:20
Allows me to remove extra space, and ultimately extra <p> and <br>, from shortcodes.
// We have to remove the default shortcode filter
remove_filter( 'the_content', 'do_shortcode', 11 ); // AFTER wpautop()
// Strips extra space around and within shortcodes
add_filter( 'the_content', 'shortcode_cleanup', 11 );
function shortcode_cleanup( $content ) {
// Clean it
$content = strtr( $content, array( "\n[" => '[', "]\n" => ']', '<p>[' => '[', ']</p>' => ']', ']<br>' => ']', ']<br />' => ']' ) );
@bamadesigner
bamadesigner / getpocket
Last active April 22, 2020 16:04
Get Your Pocket Items (And Filter By Tag) to List On Your Website
<?php
HAS BEEN MOVED TO https://github.com/bamadesigner/pocket-to-wordpress.
/**
* This adventure into the Pocket API was inspired
* because I wanted to get all of my Pocket items
* that were tagged "reading" and display them as
* a reading list on my website.
*
@bamadesigner
bamadesigner / functions.php
Last active October 20, 2016 13:42
WordPress Multsite - wp_get_post_featured_image_src() - Get wp_get_attachment_image_src() data for any post's featured image on your network
/**
* This function allows you to retrieve the wp_get_attachment_image_src()
* data for any post's featured image on your network. If you are running
* a multisite network, you can supply another blog's ID to retrieve a post's
* featured image data from another site on your WordPress multisite network.
*
* Does not take care of icon business (at this time).
*
* If successful, this function returns an array of the following:
* [0] => url