Skip to content

Instantly share code, notes, and snippets.

View davemac's full-sized avatar

davemac davemac

View GitHub Profile
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
get_option( 'woocommerce_view_order_page_id' );
get_option( 'woocommerce_terms_page_id' );
@davemac
davemac / change_events_view_titles.php
Created June 21, 2016 10:57 — forked from theeventscalendar/change_events_view_titles.php
Changes the title/headings on Events views
<?php
/*
* Alters event's archive titles
*/
function tribe_alter_event_archive_titles ( $original_recipe_title, $depth ) {
// Modify the titles here
// Some of these include %1$s and %2$s, these will be replaced with relevant dates
$title_upcoming = 'Upcoming Events'; // List View: Upcoming events
@davemac
davemac / edit-woocommerce-checkout-template.php
Created March 17, 2016 22:32 — forked from bekarice/edit-woocommerce-checkout-template.php
Add content and notices to the WooCommerce checkout - sample code
/**
* Each of these samples can be used - note that you should pick one rather than add them all.
*
* How to use WC notices: https://github.com/woothemes/woocommerce/blob/master/includes/wc-notice-functions.php#L96
* Tutorial: http://www.skyverge.com/blog/edit-woocommerce-templates/
**/
/**
* Add a content block after all notices, such as the login and coupon notices.
*
@davemac
davemac / mangle.sh
Created March 3, 2016 07:18 — forked from alphapapa/mangle
Easily grep for and view relevant parts of man pages (suitable for aliasing to "man")
#!/bin/bash
# Get section
if [[ $1 =~ [0-9]+ ]]
then
section=$1
shift
fi
# Find the longest set of args that gets a man page
<?php
/*
* Plugin Name: Remove crazy counts slowing down my dashboard
* Plugin URI: https://pmgarman.me
* Description: Those comment counts are such a pain when you have a lot of comments
* Author: Patrick Garman
* Author URI: https://pmgarman.me
* Version: 1.0.0
* License: GPLv2
*/
@davemac
davemac / Default (OSX).sublime-keymap
Last active August 29, 2015 14:28 — forked from beaugunderson/Default (OSX).sublime-keymap
Sublime Text macros for converting to and from 2 and 4 space indentation
[
{
"keys": ["ctrl+2"],
"command": "run_macro_file",
"args": {
"file": "Packages/User/to-2.sublime-macro"
}
},
{
"keys": ["ctrl+4"],
@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
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 / .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/
@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.