Skip to content

Instantly share code, notes, and snippets.

View AramZS's full-sized avatar
🎯
Focusing

Aram Zucker-Scharff AramZS

🎯
Focusing
View GitHub Profile
@AramZS
AramZS / sanitize.php
Created May 7, 2015 17:19
Hyper-viligent WP sanitization from PressForward
/**
* Sanitize a string for use in URLs and filenames
*
* @since 1.7
* @link http://stackoverflow.com/questions/2668854/sanitizing-strings-to-make-them-url-and-filename-safe
*
* @param string $string The string to be sanitized
* @param bool $force_lowercase True to force all characters to lowercase
* @param bool $anal True to scrub all non-alphanumeric characters
* @return string $clean The cleaned string
@AramZS
AramZS / Brightcove.html
Last active September 2, 2015 08:22
Brightcove
<!-- Start of Brightcove Player -->
<div style="display:none">
</div>
<div id="thePlayer">
<!--
By use of this code snippet, I agree to the Brightcove Publisher T and C
found at https://accounts.brightcove.com/en/terms-and-conditions/.
-->
@AramZS
AramZS / Author_leaderboard.php
Last active September 5, 2015 17:25
Test functions based on PF stats for collecting data
<?php
function pf_test_author_leaderboard(){
$c = 0;
$the_query = new WP_Query(
array(
'post_type' => 'post',
'nopaging' => true,
'no_found_rows' => true,
'cache_results' => false,
@AramZS
AramZS / gist:3006740
Created June 27, 2012 20:39
pullquotes!
<div class="pullquote" style="width:150px;float:right;padding:6px;margin-left:6px;margin-right:6px;border-left:1px solid black;font-weight:bold;"> The only downside of the memory system, the STM in particular, is that it can sometimes be too much. The limited inventory encourages some tactical thinking, but when a puzzle is stumping you (and they will stump you) the ability to potentially bring every available object in the game into a conversation can feel overwhelming. </div>​
@AramZS
AramZS / WP_killer_excerpt.php
Created September 5, 2012 12:36
a 'killer' excerpt that allows you to include formatting tags and control the excerpt based on wordcount.
//Set the function up to receive any custom excerpt set by the user.
function a_killer_excerpt( $text ) {
//We'll be using the post object, so we need to call the global object down to play with later.
global $post;
//This if loop makes it so it will only display this modified excerpt if the user hasn't manually set one.
if ( '' == $text ) {
//Get the full content of the post.
$text = get_the_content('');
//Apply all the_content's standard filters.
$text = apply_filters('the_content', $text);
@AramZS
AramZS / bootstrap-tumblr
Last active December 14, 2015 21:08
XKit code to give Tumblr a responsive, fluid, infinitly scrolling, two post column dashboard. Great for big screens.
//* VERSION 1.0 REV A **//
//* TITLE Bootstrap Tumblr **//
//* DESCRIPTION Gives the dashboard 2 responsive columns. Great for wide screens. **//
//* DEVELOPER Aram Zucker-Scharff **//
var jQ = jQuery.noConflict();
jQuery(document).ready(function() {
/**
* jQuery Masonry v2.1.08
* A dynamic layout plugin for jQuery
* The flip-side of CSS Floats
@AramZS
AramZS / gist:5923140
Last active December 19, 2015 08:08
Social media buttons for WordPress
<?php
?>
<script async src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="<?php the_permalink(); ?>" show_faces="false" width="349" action="recommend" data-colorscheme="light" font=""></fb:like>
<a href="http://twitter.com/share" class="twitter-share-button" data-url="<?php the_permalink(); ?>" data-text="<?php the_title(); ?>" data-count="horizontal" data-via="Chronotope">Tweet</a><script async type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<su:badge layout="2" location="<?php the_permalink(); ?>"></su:badge>
<g:plusone size="medium" href="<?php the_permalink(); ?>"></g:plusone>
@AramZS
AramZS / sidebar-for-anyone
Last active December 20, 2015 11:19
Quick and dirty universal sidebar HTML
<div class="quick-sidebar" style="width:100px; height:auto; float:right; margin-right: 10px; margin-left: 10px; margin-top: 10px; margin-bottom: 10px; border: 1px solid black; padding: 6px;">
Your content goes in here. It can be images, words, video, or anything.
All the numbers to control how this are contained inside the style attribute above.
Width and height are for size control. Leave out height and the box will get as long as you need it to be to contain text.
You must set a width.
Float controls if it sits on the right or left side of the page.
The margins control the amount of empty space that sits on the side of the sidebar designated after the hyphan.
Border controls the border size, line type, and color.
Basic color names can be found at http://www.w3schools.com/html/html_colornames.asp
And here are the border styles - http://www.w3schools.com/css/css_border.asp
@AramZS
AramZS / Post related objects
Last active December 31, 2015 16:09
WordPress Objects
<?php
/**
* Tag
object(stdClass)#427 (9) {
["term_id"]=>
string(2) "18"
["name"]=>
string(4) "test"
["slug"]=>
string(4) "test"
@AramZS
AramZS / co-authors-to-wp-seo.php
Created April 24, 2014 17:37
Get Co-Authors-Plus to talk with Yoast's WP-SEO
<?php
function wp_co_author_title($title){
if (is_author()){
$aTitle = get_the_author();
if (empty($aTitle)){
if (function_exists('get_coauthors')){
$qo = get_queried_object();
$bTitle = $qo->display_name;
return $bTitle . $title;