Skip to content

Instantly share code, notes, and snippets.

@tnog
tnog / wp-rss2-image-enclosure.php
Created September 27, 2023 17:26 — forked from DaveyJake/wp-rss2-image-enclosure.php
WP RSS 2.0 Image Enclosure with File Size
<?php
/**
* Wordpress RSS Image Enclosure
*
* Wrap ONLY the featured image inside 'enclosure' tags.
*
* @author Davey Jacobson
* @link https://www.daveyjake.dev
*
* @package DJ_Dev
@tnog
tnog / wordpress-block-placeholder.html
Last active November 12, 2022 00:11
WordPress Block Dummy Content
<!-- wp:heading {"level":1} -->
<h1>This is a heading (H1)</h1>
<!-- /wp:heading -->
<!-- wp:heading -->
<h2>This is a heading (H2)</h2>
<!-- /wp:heading -->
<!-- wp:heading {"level":3} -->
<h3>This is a heading (H3)</h3>
<?php
/**
* Clears entire WP Engine cache
* @return void
*/
public function wpeCacheFlush() {
// Only initiates a cache clear if the $cleared property is false
if (!self::$cleared) {
<?php
namespace To4Framework;
if (!defined('ABSPATH')) {
exit;
}
class CachingAds extends Caching
{
<?php
namespace To4Framework;
if (!defined('ABSPATH')) {
exit;
}
/**
* Wrapper class to display admin and debug.log messages.
@tnog
tnog / customer_registration_email_alert.php
Created March 30, 2017 05:08
WooCommerce: Send a custom admin email when a new customer creates a new account.
<?php
namespace Your\Custom\Namespace;
/**
* Send a custom admin email when a new customer creates a new account.
* @param integer $user_id The ID of the user whose data should be retrieved.
* @return [type] [description]
*/
function customer_registration_email_alert( $user_id ) {
@tnog
tnog / Tracker.js
Created July 7, 2016 21:04 — forked from juriansluiman/Tracker.js
Track outbound links and form submits with Google Analytics Universal code
/**
* Create a Tracker module for Google Analytics
*
* This tracker enables to track clicks on links and submits on forms. Usually
* these events will not be recorded as the window.location is changed and the
* request to Google Analytics is cancelled. This module prevents default
* behaviour, tracks the Google Analytics event and then continues the link/submit.
*
* Data attributes are used to augment the event with category/action/label values.
* Use them as "data-track-category", "data-track-action" and "data-track-label".
function asanaRequest($methodPath, $httpMethod = 'GET', $body = null)
{
$apiKey = 'ASANA_API_KEY_HERE'; /// Get it from http://app.asana.com/-/account_api
$url = "https://app.asana.com/api/1.0/$methodPath";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC ) ;
curl_setopt($ch, CURLOPT_USERPWD, $apiKey);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
(function($) {
// Create custom plugin to handle AJAX queries and to build containers
$.fn.displayPost = function() {
$(this).click(function(event){
event.preventDefault();
// grabs the id for the target post
var post_id = $(this).data("id");
// We'll define the div id for the container here
var id = "#" + post_id;
@tnog
tnog / gist:5834404
Last active December 18, 2015 19:39
<?php
/*
Plugin Name: Sketchbook Plugin
Plugin URI: http://takahironoguchi.com
Description: A custom tumblr style wall plugin. Requires installation of Elliot Condon's ACF plugin: www.advancedcustomfields.com. And uses sy4mil's Aqua-Resizer https://github.com/sy4mil/Aqua-Resizer
Version: 1.0
Author: Takahiro Noguchi
Author URI: http://takahironoguchi.com/
License: GPLv2
License: GPLv2 or later