Skip to content

Instantly share code, notes, and snippets.

View shaneonabike's full-sized avatar

Shane @ Symbiotic.coop shaneonabike

View GitHub Profile
@shaneonabike
shaneonabike / import.php
Last active January 21, 2020 18:40
Wordpress Inject Countries
<?php
function insert_countries() {
wp_insert_term('CA', 'countries', array('description'=>'Canada'));
$array_data = csv_to_array('/var/www/cinema/wp-content/themes/cp-theme/country.csv');
// Knock off the first line
array_shift($array_data);
foreach($array_data as $data)
{
SELECT n.nid FROM node n LEFT JOIN search_dataset d ON d.type = 'node' AND d.sid = n.nid WHERE d.sid IS NULL OR d.reindex <> 0 ORDER BY d.reindex ASC, n.nid asc;
@shaneonabike
shaneonabike / popup.js
Created September 11, 2018 13:36
Popup JS
jQuery(function($) {
// Scroll the popup with the user
$(window).scroll(function() {
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var popupWidth = $("#likeus").width();
var popupHeight = $("#likeus").height();
var topPopup = windowHeight * 2 / 3 + $(window).scrollTop();
var leftPopup = windowWidth - popupWidth;
@shaneonabike
shaneonabike / popup.css
Created September 11, 2018 13:35
Popup CSS
/**
* Like Us Popup CSS
*/
#likeus {
width:342px;
height:170px;
border: 1px solid #666;
background-color:#fff;
-webkit-box-shadow: 0 0 16px #666;
box-shadow: 0 0 16px #666;
@shaneonabike
shaneonabike / page.html
Last active September 11, 2018 13:35
Popup code body
<div id="likeus"><div id="likeus-wrapper">
<div id="likeus-banner">&nbsp;</div>
<div id="likeus-inner">
<h2>Join us on Facebook</h2>
<div class="fb-like" width="300" data-href="http://www.facebook.com/yourpath" data-layout="standard" data-action="like" data-show-faces="false" data-share="true"></div>
<div id="likeus-close-wrapper">
<a href="#likeus" class="close-like">Close</a> ·
<a href="#likeus"> class="close-forever">I already like Bees on a Bike</a>
</div>
</div>
@shaneonabike
shaneonabike / template.php
Created September 11, 2018 13:31
Drupal Timefield exposed filter integration (template.php)
/**
* Preprocess output of form element
*
*/
function yourtheme_preprocess_form_element(&$vars) {
if (!empty($vars['element']['#id']) && ($vars['element']['#id'] == 'edit-hour')) {
// Add special class for JS to work properly but we need to edit the #children value :/
$children = $vars['element']['#children'];
if (!empty($children)) {
$vars['element']['#children'] = str_replace('form-text', 'form-text edit-timefield-timepicker filter-project-event-time', $children);
@shaneonabike
shaneonabike / yourmodule.module
Created September 11, 2018 13:28
Drupal Timefield exposed filter
<?php
/**
* Alter the exposed form for the projects view
*
* $form
* Relative form that is being created
* $form_state
* Existing statee
*/