Skip to content

Instantly share code, notes, and snippets.

View jo-snips's full-sized avatar

Jonah West jo-snips

View GitHub Profile
<?php
/**
* update ~line 26 to include 2 argument params as such:
*/
add_filter( 'posts_orderby', array( __CLASS__, 'events_search_orderby' ), 10, 2 );
/**
* update static function `events_search_orderby` (replace with the following method starting at ~line 159)
*/
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs['description'] ); // Remove the description tab
unset( $tabs['reviews'] ); // Remove the reviews tab
unset( $tabs['additional_information'] ); // Remove the additional information tab
return $tabs;

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
// Customize Events Community Datepicker
if($("div.tribe-community-events-date input.datepicker").length) {
var datepickerOpts = {
dateFormat: 'yy-mm-dd',
changeMonth: true,
changeYear: true,
onSelect: function(selectedDate) {
var option = this.id == "EventStartDate" ? "minDate" : "maxDate";
var instance = $(this).data("datepicker");
var date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
<?php
add_action( 'init', 'tribe_events_wootheme_compatibility' );
function tribe_events_wootheme_compatibility() {
if ( ! is_home() ) {
remove_filter( 'pre_get_posts', 'woo_exclude_categories_homepage', 10 );
}
}
<?php
// use this method to replace the orininal in v1.0.5 (line 273 in the-events-calendar-facebook-importer.php)
function get_facebook_photo( $object_id ) {
$api_url = $this->build_url_with_access_token( $object_id . '/', array( 'fields' => 'cover', 'return_ssl_resources' => 1 ) );
$api_request = $this->json_retrieve( $api_url );
$new_path = $api_request->cover->source;
$get_photo = wp_remote_get( $api_request->cover->source );
// setup return object
$photo['url'] = $new_path;
<?php
/*
Template Name: Stock Report :)
*/
if (!is_user_logged_in() || !current_user_can('manage_options')) wp_die('This page is private.');
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<?php
/**
* Loop Add to Cart
*/
global $product;
if( $product->get_price() === '' && $product->product_type != 'external' ) return;
?>
</php
/**
* Facebook Page Feed Parser
*
* @using cURL
*/
function fb_parse_feed( $page_id, $no = 5 ) {
// URL to the Facebook page's RSS feed.