Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / single-event.php
Created March 21, 2017 15:28
The Events Calendar Pro: Recurring events list in single event page.
<p>This event is planned on:</p>
<p class="current-date">
<?php
echo tribe_get_start_date();
echo ' - ';
echo tribe_get_end_date();
?>
</p>
<?php
global $post;
@jackcarter
jackcarter / slack_delete.py
Last active November 29, 2023 07:03
Delete Slack files older than 30 days. Rewrite of https://gist.github.com/jamescmartinez/909401b19c0f779fc9c1
import requests
import time
import json
token = ''
#Delete files older than this:
ts_to = int(time.time()) - 30 * 24 * 60 * 60
def list_files():
@fotinakis
fotinakis / hide-text.js
Last active January 31, 2017 21:04
Pure JavaScript: Hide all text on the page but preserve element spacing.
function textNodesUnder(el){
var n, a = [];
var walk = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, null, false);
while (n = walk.nextNode()) { a.push(n); }
return a;
}
// Normalize all text nodes (merge adjacent nodes).
var elements = document.getElementsByTagName('*');
for (var i = 0; i < elements.length; i++) {
@srikat
srikat / functions.php
Last active December 12, 2020 23:45
Adding a cart icon with number of items and total cost in nav menu when using WooCommerce. http://sridharkatakam.com/adding-cart-icon-number-items-total-cost-nav-menu-using-woocommerce/
//* Make Font Awesome available
add_action( 'wp_enqueue_scripts', 'enqueue_font_awesome' );
function enqueue_font_awesome() {
wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css' );
}
/**
* Place a cart icon with number of items and total cost in the menu bar.
@sniperwolf
sniperwolf / ajax.php
Last active December 29, 2022 12:25
Super-Simple WordPress ajax post-popup with jQuery and Reveal plugin
<?php
/**
* Template Name: ajax
*/
?>
<?php
$post = get_post($_GET['id']);
?>
<?php if ($post) : ?>
<?php setup_postdata($post); ?>
@jo-snips
jo-snips / events-conditional-wrappers.php
Last active December 21, 2023 12:27
The Events Calendar: Basic Conditional Wrappers
<?php
/*-----------------------------------------------------------------------------------*/
/* Conditional Logic to Detect Various Event Related Views/Pages
/*-----------------------------------------------------------------------------------*/
if( tribe_is_month() && !is_tax() ) { // Month View Page
echo 'were on the month view page';
} elseif( tribe_is_month() && is_tax() ) { // Month View Category Page