Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mintindeed
mintindeed / PgCache.php
Created January 4, 2012 18:25
Modified W3TC PgCache.php file to work with nginx-memcached interface
<?php
// Look for "@custom" to see customizations
// Sourced from W3TC v0.9.2.4
// Full path: /w3-total-cache/lib/W3/PgCache.php
/**
* W3 PgCache
*/
/**
* Class W3_PgCache
/**
* function to implement [pmc_post_top_tag_names] shortcode to fetch top N tag names for a post
*/
public function post_top_tag_names($attrs) {
extract(shortcode_atts(array(
'post' => 0,
'count' => 3,
'tags' => 'strong,em'
), $attrs));
$_tags_enum = array('strong', 'em', 'b', 'i'); //html tag whitelist
@mintindeed
mintindeed / gist:2847279
Created May 31, 2012 23:48
WordPress fetch_feed() usage example for non-post feeds
$rss = fetch_feed('http://example.com/feed/');
if ( ! $rss ) {
return;
}
$maxitems = $rss->get_item_quantity();
if ( ! $maxitems ) {
return;
}
@mintindeed
mintindeed / fastcgi_params.conf
Created June 21, 2012 20:12
WordPress + nginx config
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_read_timeout 300;
fastcgi_send_timeout 300;
fastcgi_ignore_client_abort off;
fastcgi_intercept_errors on;
fastcgi_connect_timeout 120;
fastcgi_buffer_size 128k;
@mintindeed
mintindeed / gist:2981993
Created June 24, 2012 06:27
WordPress get the top X tags for a post, based on how many times the tag has been used
<?php
/**
* Helper function to get the top X tags for a post, based on how many times
* the tag has been used overall.
*
* @param int $post_id
* @param int $max_tags
* @return boolean|array
*/
function pmc_get_top_tags( $post_id, $max_tags = 3 ) {
@mintindeed
mintindeed / gist:3101724
Created July 12, 2012 23:09
WordPress Cachebuster for Development
function pmc_dev_cachebuster( $src ) {
return add_query_arg( 'ver', time(), $src );
}
add_filter( 'style_loader_src', 'pmc_dev_cachebuster' );
add_filter( 'script_loader_src', 'pmc_dev_cachebuster' );
<div class="hl-logo-tease left">
<div class="inner">
<?php if(is_page('hollyscopes') || $post->post_parent=="9"):?>
<div class="logo-wrapper">
<a href="<?php echo pmc_heatmap_url('/','masthead')?>" class="logo"><img src="<?php bloginfo('template_directory') ?>/images/theme/spacer.gif" alt="Hollywood Life by Bonnie Fuller, Your Celebrity News, Gossip and Style BFF" />Hollywood Life</a>
</div>
<div class="hl-logo-mid left">
<img src="<?php bloginfo('template_directory') ?>/images/theme/spacer.gif" alt="Hot" class="gap-fix" />
</div>
<?php $logob = 'nhs';?>
<?php
abstract class PMC_Base {
private static $_instance = array();
protected function __construct() {}
public static function get_instance() {
$class = get_called_class();
if ( ! isset( self::$_instance[$class] ) ) {
self::$_instance[$class] = new $class();
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<title>Untitled</title>
</head>
<body>
<script>
var _dc_ts = Math.random();
success: function() {
// load stories here
// Build the current image
var real_path = document.location.href.replace("#!/", "");
// Track PV in Omniture
try {
s_mmc.pageName = real_path;
s_mmc.t();