Skip to content

Instantly share code, notes, and snippets.

@ammist
ammist / tl-events.php
Created July 5, 2013 23:44
This is a simple way to add event meta field on WordPress posts. You could use this for a custom post type, but this is some code I wrote in 2010 to extend Thesis with event information. It doesn't support recurring events, or a calendar view, but it's pretty darn handy for something really simple.
<?php
/**
* TL EVENTS
*
* Functionality for adding time, date for events, displaying them by week, etc.
* This assumes your events are posts in the "Events" category, but could easily be
* extended to other stuff.
*/
@ammist
ammist / genesis_comments_functions.php
Created July 27, 2013 22:38
Genesis Comment Hacking - change the time and date. You can put this in your functions.php file. If you do this, your comments will show a relative date (e.g. posted 10 days ago). The original genesis code is in the /genesis/lib/structure/comments.php file.
function my_comment_listing($comment, $args, $depth){
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">
<?php do_action( 'genesis_before_comment' ); ?>
<div class="comment-header">
<div class="comment-author vcard">
@ammist
ammist / find-copy-change
Last active January 1, 2016 15:18
find files newer than [filename] and copy them to [dirname]
find . -type f -newer '[filename]' -print0 | xargs -0 -I {} cp {} [dirname]
# replace strings in a file without creating a backup. the -i parameter would create a backup if you so desired
sed -i '' 's/techliminal/localhost/g' [filename]
# find all the javascript files and list them
find . -name *.js -print | xargs ls -l
# change the owner of all the javascript files
# Looks like the sudo has to be on the xargs / chown part of the operation
@ammist
ammist / Notes
Created June 30, 2014 18:58
Image Getting w/ Genesis
Genesis_image will return full HTML (it may not be what you are looking for).
@ammist
ammist / gist:0ec470e125b39d718b6b
Last active August 29, 2015 14:04
jQuery Carousel Basics
<html>
<head>
<script type='text/javascript' src='jquery-1.11.1.min.js'></script>
<script type='text/javascript'>
$( document ).ready(function() {
console.log( "ready!" );
});
</script>
@ammist
ammist / blog_table_move.sql
Last active August 29, 2015 14:05
Moving Posts from one site to Another.
rename table wp_79_posts to wp_tmp_posts, wp_79_postmeta to wp_tmp_postmeta, wp_79_terms to wp_tmp_terms, wp_79_term_taxonomy to wp_tmp_term_taxonomy, wp_79_term_relationships to wp_tmp_term_relationships, wp_79_p2p to wp_tmp_p2p, wp_79_p2pmeta to wp_tmp_p2pmeta;
create table wp_79_posts like wp_posts;
INSERT wp_79_posts SELECT * FROM wp_posts;
create table wp_79_postmeta like wp_postmeta;
INSERT wp_79_postmeta SELECT * FROM wp_postmeta;
--
create table wp_79_terms like wp_terms;
INSERT wp_79_terms SELECT * FROM wp_terms;
create table wp_79_term_taxonomy like wp_term_taxonomy;
@ammist
ammist / .gitignore
Last active August 29, 2015 14:06
Default Tech Liminal .gitignore file
*/.ssh
.ssh/*
.mysql_history
.vim*
.bash*
.htaccess
*~
.DS_Store
.svn
.cvs
@ammist
ammist / multiplex-read.c
Created March 31, 2015 04:20
Basic Arduino Multiplexer code
/*
* Reading switches and tell to Serial.
*
*/
int numPins = 2;
int out[] = {4,5};
int in[] = {2,3};
@ammist
ammist / profile-summary.php
Last active July 13, 2016 01:59
ACF Fields in HTML Example with genesis tempate
<?php
/*
* Displays in a list form an ACF repeater field with three subfields
* Field: urls
* Sub-FieldS: label, link, style,
*
*/
$post = get_queried_object();
@ammist
ammist / wordpress.php
Created November 20, 2016 06:38
WordPress Posts, Postmeta, Posts 2 Posts Queries
/*
* Get the events for each person
*/
$events = new WP_Query(
array (
'post_type' => 'event',
'connected_type' => 'speaker_to_event',
'connected_items' => $speaker->ID,