Skip to content

Instantly share code, notes, and snippets.

View davemac's full-sized avatar

davemac davemac

View GitHub Profile
@davemac
davemac / events-conditional-wrappers.php
Created July 19, 2012 12:07 — forked from jo-snips/events-conditional-wrappers.php
The Events Calendar: Basic Conditional Wrappers
if( tribe_is_month() && !is_tax() ) { // The Main Calendar Page
} elseif( tribe_is_month() && is_tax() ) { // Calendar Category Pages
} elseif( tribe_is_event() && !tribe_is_day() && !is_single() ) { // The Main Events List
} elseif( tribe_is_event() && is_single() ) { // Single Events
} elseif( tribe_is_day() ) { // Single Event Days
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: T5 Parent Terms in body_class
* Description: Adds all parent terms of a term archive to <code>body_class()</code>.
* Version: 2012.0.14
* Author: Thomas Scholz <info@toscho.de>
* Author URI: http://toscho.de
* License: MIT
* License URI: http://www.opensource.org/licenses/mit-license.php
*/
<?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
<?php
/**
* Change text strings
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Related Products' :
$translated_text = __( 'Check out these related products', 'woocommerce' );
<h1 class="emerald bg-midnight_blue">Lorem ipsum dolor sit amet</h1>
<?php
$location = get_post_meta( get_the_ID(), 'be_address', true );
echo '<p><a href="https://www.google.com/maps/preview#!q=' . urlencode( $location['address'] ) . '"><img src="http://maps.googleapis.com/maps/api/staticmap?center=' . urlencode( $location['lat'] . ',' . $location['lng'] ). '&zoom=13&size=167x171&maptype=roadmap&sensor=false&markers=color:red%7C' . $location['lat'] . ',' . $location['lng'] . '" /></a></p>';
@davemac
davemac / wrapembed
Last active August 10, 2016 10:16 — forked from brichards/functions.php
wrap embed video with container
<?php
/**
* Wrap an embedded video with a container for simpler styling.
*
* @since 1.0.0
*
* @param string $output HTML Markup.
* @param string $url oEmbed URL.
@davemac
davemac / .htaccess
Last active August 29, 2015 14:24 — forked from solepixel/.htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
# Use uploads directory from live site
RewriteBase /wp-content/uploads/
RewriteCond %{HTTP_HOST} !^www\.livedomain\.com
RewriteCond %{HTTP_HOST} !^livedomain\.com
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/
function ps_get_social_count( $post_id, $flush_cache = false ) {
if( $flush_cache || false === ( $like_count = get_transient('like_count_' . $post_id) ) ) {
$url = get_permalink($post_id);
$fb_like_count = ps_get_fb_count($url);
$tweet_count = ps_get_tweet_count($url);
$gplus_count = ps_get_google_plus_count($url);
$pinterest_count = ps_get_pinterest_count($url);
@davemac
davemac / .gitignore
Last active August 29, 2015 14:27 — forked from jjeaton/.gitignore
WordPress root .gitignore. Ignore everything and then opt-in (exclude from the ignore) for your custom code.
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your