Skip to content

Instantly share code, notes, and snippets.

<?php
/*
* Order posts by title
*
* @see https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
*
* Notes:
* - 'zewpgists_' is a prefix for all my gists. Replace with your own.
*
*/
@zedejose
zedejose / zewpgists_filter_tribe_events_widget.php
Last active February 4, 2018 15:12
Code to exclude the single event we're viewing from the events list on the widget.
<?php
/*
* Code to exclude the single event we're viewing from
* the events list on the widget.
*
* Notes:
* - Only works with the Events Calendar plugin (Modern Tribe).
* - 'zewpgists_' is a prefix for all my gists. Replace with your own.
*
*/
@zedejose
zedejose / fadein.css
Created July 25, 2017 22:22 — forked from hugobaeta/fadein.css
Page loading fade-in
@keyframes fadein {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
/* Each element you want to fade in in sequence should have a incremental delay in the animation - more here: https://developer.mozilla.org/en-US/docs/Web/CSS/animation */
@zedejose
zedejose / gist:4edda33e9819fc4fcd3d
Last active August 29, 2015 14:00
Get Entire Post Or Page In A PHP Variable
<?php
// From http://www.smashingmagazine.com/2009/08/18/10-useful-wordpress-hook-hacks/
function callback($buffer) {
// modify buffer here, and then return the updated code
return $buffer;
}
@zedejose
zedejose / add_draft_count.php
Last active December 29, 2015 04:28
Code to add a count bubble of draft posts to the Posts menu.
// Add a count of draft posts to the Posts menu
function zedejose_add_draft_count() {
global $menu;
$count_posts = wp_count_posts();
$draft_posts = $count_posts->draft;
$menu[5][0] = $menu[5][0] . '<span class="update-plugins count-2"><span class="plugin-count">' . (int)$draft_posts . '</span></span>';
}
<?php
class CWS_Jetpack_Modules {
function __construct() {
add_filter( 'option_jetpack_active_modules', array( $this, 'active_modules' ) );
}
function active_modules( $modules ) {
$allowed_modules = array(
'enhanced-distribution',
<?php
/*
* Plugin Name: Hacky Taxonomy Archives
* Description: Don't use this on a live site, plz. Proof of concept for Aaron Holbrook.
* Author: Andrew Nacin
*/
add_action( 'template_redirect', function() {
global $wp_rewrite;
$taxonomy = 'fruits';