Skip to content

Instantly share code, notes, and snippets.

View mathetos's full-sized avatar
💭
Working on @impress-org Stuff

Matt Cromwell mathetos

💭
Working on @impress-org Stuff
View GitHub Profile
@mathetos
mathetos / search.txt
Created April 25, 2024 14:46
Custom Google Search
/* Add this into your Chrome/Chromium
* Address Bar and Search settings as a New Search Engine
* Give it a shortcut name like "search"
* Set it as your default search engine
* Now every time you search through the Address Bar
* or type "search" then TAB you'll get your Google search results
* But without listicles and review sites
*/
{google:baseURL}search?q=%s+-"Must-have"+-"best"+-"Top+10"+-"The+best+online"+-site%3Ag2.com+-site%3Acapterra.com+-site%3Atrustpilot.com+-site%3Areddit.com+-site%3Aquora.com+-site%3Acapterra.com.de
@mathetos
mathetos / plugin.php
Last active April 9, 2024 17:10
Get User Admin Color Schemes for UI styling
<?php
// Add Current Users Admin Color Scheme
// 1. Create helper function to grab individual colors easily
// 2. Add individual colors to document root as CSS variables
function wpptpcv_return_admin_colors() {
global $_wp_admin_css_colors;
// Get the user's selected color scheme name
@mathetos
mathetos / plugin.php
Last active April 13, 2023 16:48
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/
*
*/
<?php
/**
* Optimize WooCommerce Scripts
* Updated for WooCommerce 2.0+
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
<?php
/**
* Plugin Name: Impact Radius for WooCommerce
* Description: Output Impact Radius affiliate tracking codes to integrate with WooCommerce
* Author: The Events Calendar
* Author URI: https://evnt.is
* Version: 1.0
*/
add_action( 'init', function () {
@mathetos
mathetos / code.js
Created March 19, 2022 17:21
Google Script to Process Webhook JSON and add Row in Google Sheets
function doPost(e) {
var body = e.postData.contents;
var bodyJSON = JSON.parse(body);
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Submissions");
var timeStamp = new Date();
var time = Utilities.formatDate(timeStamp, "GMT-08:00", "MM/dd/yy, h:mm a");
var lastRow = sheet.getLastRow();
@mathetos
mathetos / image-upload-field-custom-taxonomy
Created September 20, 2014 21:37
Add Image Upload Field to Custom Taxonomy
<?php
/* Add Image Upload to Series Taxonomy */
// Add Upload fields to "Add New Taxonomy" form
function add_series_image_field() {
// this will add the custom meta field to the add new term page
?>
<div class="form-field">
<label for="series_image"><?php _e( 'Series Image:', 'journey' ); ?></label>
@mathetos
mathetos / feed-offset
Last active October 22, 2020 17:36
WordPress Custom RSS Feed with Offset
<?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;
@mathetos
mathetos / custom-wordpress-feed
Created December 9, 2014 03:30
Custom WordPress RSS Feed with Featured Image Enclosure
<?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);
@mathetos
mathetos / init.php
Created April 17, 2020 04:49
Enqueue custom editor stylesheet for Elementor
<?php
add_action('elementor/editor/before_enqueue_scripts', 'custom_editor_enqueue_scripts');
// editor styles
function custom_editor_enqueue_scripts() {
// If you're making a GiveWP add-on and need the Give admin styles, you'll need to enqueue it here as well
wp_enqueue_style( 'give-admin-styles', GIVE_PLUGIN_URL . 'assets/dist/css/admin.rtl.css', array(), GIVE_VERSION );