Skip to content

Instantly share code, notes, and snippets.

View johnnyicarus's full-sized avatar

Marin Aeschbach johnnyicarus

View GitHub Profile
@johnnyicarus
johnnyicarus / trellis_project.sh
Last active January 5, 2017 15:03
Create a new roots/trellis and roots/bedrock project in a subfolder named with the -n option; usage: sh trellis_project.sh -n foldername
#!/bin/bash
while getopts ":n:" opt; do
case $opt in
n)
echo "Trellis project will be put into directory: $OPTARG" >&2;
mkdir $OPTARG;
cd $OPTARG;
git clone --depth=1 [email protected]:roots/trellis.git;
rm -rf trellis/.git;
@johnnyicarus
johnnyicarus / the_terms_by_level
Last active August 29, 2015 14:04
WordPress utilities, allows the separate display of explicit levels of hierarchial taxonomies
/**
* Template Tag: the_terms_by_level
*
* Echoes the links of all the terms on the same explicit hierarchical level
* associated with a certain taxonomy. You should pass a separator.
*
* @param $id int post id
* @param $taxonomy string the taxonomy
* @param $level int level of the hierarchy to echo (top level = 0)
* @param $sep string separator
@johnnyicarus
johnnyicarus / gist:9643945
Created March 19, 2014 15:19
Remove WPML Generator Tag
/**
* Remove <meta name="generator"> tag created by the WPML PLugin.
* Wrapped in an if-statement that checks for an instance of the
* sitepress-class (made global by WPML)
*
* @url http://wordpress.stackexchange.com/questions/117469/how-to-remove-wpml-generator-meta-tag-by-themes-functions-php-override-plugin
*
* @uses add_action
* @uses remove_action
* @uses current_filter
@johnnyicarus
johnnyicarus / Return Thumbnail URL
Created January 15, 2013 23:25
Function that returns the URL of a post thumbnail in Wordpress inside the loop. Used for displaying FlexSlider 2 thumbnail navigation.
function prefix_thumbnail_url( $postid ) {
$post_image_id = get_post_thumbnail_id( $postid );
$thumbnail = wp_get_attachment_image_src( $post_image_id, $image-size, false);
if ($thumbnail) (string)$thumbnail = $thumbnail[0];
return $thumbnail;
}