Skip to content

Instantly share code, notes, and snippets.

View mathetos's full-sized avatar
🪐
Working on @stellarwp Stuff

Matt Cromwell mathetos

🪐
Working on @stellarwp Stuff
View GitHub Profile
@mathetos
mathetos / give-ify-github.css
Last active September 7, 2018 16:06
Give-ify your Github
/*
* Give-ify your Github
* Preview: https://cloudup.com/cGiBiRpMd3B
*
* Step 1: Install the "Refined Github" browser extension: https://github.com/sindresorhus/refined-github
* Step 2: Use it's Custom CSS field to paste the following.
*/
@font-face {
font-family: give-icomoon;
@mathetos
mathetos / zap.js
Last active February 15, 2018 02:45 — forked from kevinwhoffman/zap.js
Get Unassigned from HelpScout
/*
* HelpScout Zap: Get Number of Unassigned in a Specific Mailbox
* Use Zapier's "Code" Action to trigger this
* This only works with Zapier, it depends on the "callback" functions
*/
var btoa = function (str) {return new Buffer(str).toString('base64');};
fetch('https://api.helpscout.net/v1/mailboxes/{HELPSCOUT_MAILBOX_ID}/folders.json', {
cache: 'no-cache',
@mathetos
mathetos / cf-entries.php
Last active October 8, 2017 05:26
Caldera Forms Entries Shortcode
<?php
add_shortcode('cf_entries', 'mc_cfes_output');
function mc_cfes_output($atts) {
$atts = shortcode_atts( array(
'id' => '',
'number' => '999'
), $atts, 'cf_entries' );
@mathetos
mathetos / functions.php
Last active March 15, 2017 20:29
Count open child bbPress forums
<?php
$i = 0;
$children = bbp_forum_get_subforums( array( 'post_parent' => $forum_id ) );
foreach ($children as $child) :
if ( bbp_is_forum_open( $forum_id = $child->ID ) ) {
$i++;
$status = bbp_get_forum_status( $forum_id = $child->ID );
@mathetos
mathetos / give5stars.php
Last active August 30, 2018 19:28
Shortcode to display number of 5-star ratings of a plugin on the WordPress.org Plugin Directory (aka Plugin Repo)
<?php
add_shortcode( 'give5stars', 'get_give_five_stars' );
function get_give_five_stars() {
$plugin_slug = 'give';
// Get any existing copy of our transient data
if ( false === ( $cachedresults = get_transient( 'wp-plugin-repo-data-' . $plugin_slug ) ) ) {
// It wasn't there, so regenerate the data and save the transient
@mathetos
mathetos / shortcode.php
Last active November 14, 2016 02:25
Maps Builder Mashup Location Shortcode
<?php
/**
* Displays the map
*
* @access private
* @since 1.0
* @return void
*/
function gmbsimple_map_shortcode( $atts ) {
@mathetos
mathetos / dequeue.php
Created November 3, 2016 18:35
Dequeue Maps Builder JS except certain pages
<?php
/**
* Dequeue GMB script for certain pages
*
* Hooked to the wp_print_scripts action, with a late priority (100),
* so that it is after the script was enqueued.
*/
function gmb_dequeue_script() {
global $post;
@mathetos
mathetos / better_shortcode.php
Last active October 27, 2016 04:10
Sample Shortcode with Selectively Enqueued Stylesheet
<?php
/*
* Example Shortcode and Globally Enqueued Stylesheet
*
*/
// Our Shortcode function
function hiroy_shortcode( $content = null ) {
// Enqueue the stylesheet now
wp_enqueue_style( 'hiroy-css' );
@mathetos
mathetos / shortcode.php
Last active October 27, 2016 04:09
Super basic shortcode with stylesheet enqueued globally
<?php
/*
* Example Shortcode and Globally Enqueued Stylesheet
*
*/
// Our Shortcode function
function hiroy_shortcode( $content = null ) {
// do something to $content
$content = '<h2>Hi Roy!</h2>';
@mathetos
mathetos / enqueue_example.php
Created October 26, 2016 03:13
Enqueue Global Stylesheet
<?php
// Enqueue this stylesheet globally for the front-end
add_action( 'wp_enqueue_scripts', 'themeslug_enqueue_style' );
function themeslug_enqueue_style() {
wp_enqueue_style( 'my-theme-css', 'style.css', 'parent-stylesheet', '1.0', all );
}