Skip to content

Instantly share code, notes, and snippets.

View xymox12's full-sized avatar

euanjfc xymox12

View GitHub Profile
@xymox12
xymox12 / gist:4718304
Last active December 13, 2016 23:27
Events manager - custom taxonomy and search filter
<?php
// custom host taxonomy for events
add_action( 'init', 'register_my_taxonomies', 0 );
function register_my_taxonomies() {
$labels = array(
'name' => 'Hosts',
'singular_name' => 'Host',
'search_items' => 'Search hosts',
'popular_items' => 'Popular hosts',
@xymox12
xymox12 / gist:4718315
Last active December 12, 2015 04:58
Events Manager - Search/filter but custom attribute (field) v.03
add_action('em_template_events_search_form_ddm', 'my_em_styles_search_form');
function my_em_styles_search_form(){
$custom_attrs = get_meta_values('Hosted_by','Event');
?>
<!-- START Styles Search -->
<select name="host">
<option value=''>All Styles</option>
<?php foreach($custom_attrs as $meta_name): ?>
<option value="<?php echo $meta_name; ?>" <?php echo ($_GET['host'] == $meta_name) ? 'selected="selected"':''; ?>><?php echo $meta_name; ?></option>
<?php endforeach; ?>
@xymox12
xymox12 / Consolas-for-powerline-mod.md
Last active December 16, 2015 20:19
Config files for using eugeneching / consolas-powerline-vim Font and the new Powerline
@xymox12
xymox12 / mysql2xml.php
Last active December 22, 2015 16:39
openconf query
SELECT paper.title,
GROUP_CONCAT(CONCAT('{{',
author.name_first,
'}}{{',
author.name_last,
'}}'))
AS names,
paper.abstract,
topic.topicname,
paper.paperid
@xymox12
xymox12 / excel.vb
Created September 26, 2013 13:04
Script I found online to move a html table in an email body into a excel spreadsheet. Not my own, Original Author: John_w http://www.ozgrid.com/forum/showthread.php?t=176467
Option Explicit
Public Sub Import_Survey_Emails()
Dim outApp As Outlook.Application
Dim outNs As Outlook.Namespace
Dim outFolder As Outlook.MAPIFolder
Dim outMail As Outlook.MailItem
Dim lastRow As Long
Dim destCell As Range
@xymox12
xymox12 / group-by-date.php
Created November 17, 2013 17:53
Event organiser - useful scripts
<?php $day_check = ''; /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php $day = eo_get_the_start('jS M Y');
if ($day != $day_check) {
if ($day_check != '') {
echo '</ul>'; // close the list here
}
echo eo_get_the_start('jS M Y') . '<ul>';
}
?>
<?php
class EO_Shortcode_Grouped_Lists extends EventOrganiser_Shortcodes {
static function init() {
add_shortcode('eo_group_events_by_date', array(__CLASS__, 'handle_eventlist_shortcode'));
}
// Modified copy of orginal handle_eventlist_shortcode
static function handle_eventlist_shortcode($atts = array(), $content = null) {
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ical="http://www.ietf.org/rfc/rfc2445.txt"
xmlns:itip="http://www.ietf.org/rfc/rfc2446.txt"
xmlns="http://www.ietf.org/rfc/rcf2445.txt">
<!-- ======================================================================== -->
<!-- ics2xml.xsl XSL transformation of iCalendar .ics file to XML file -->
<!-- Tim Hare, November 2006 -->
<!-- This transformation may be freely used, attribution is appreciated -->
@xymox12
xymox12 / functions.php
Created November 21, 2013 23:02
Modify multiple tinymce's on the same Advanced Custom Field post type (in this case post_type == 'fellow')
/* Tiny MCE Modifications */
function emy_refresh_mce($ver) {
++$ver; // or $ver .= 3; or ++$ver; etc.
return $ver;
}
add_filter('tiny_mce_version', 'emy_refresh_mce');
function myformatTinyMCE($in) {
@xymox12
xymox12 / gist:8089380
Created December 22, 2013 22:47
wordpress custom query
SELECT wp002_posts.post_title,
wp002_posts.post_name,
wp002_posts.post_type,
wp002_postmeta.meta_value,
wp002_pure_profiles_publication.title,
wp002_posts.post_status,
wp002_pure_profiles_publication.abstract,
wp002_pure_profiles_publication.dois,
wp002_pure_profiles_publication.numberofpages,
wp002_pure_profiles_publication.publicationyear,