This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //print page and parent slugs for css classes | |
| function page_slug_classes($classes) { | |
| global $post; | |
| $classes = array(); | |
| //get the slug of any parent pages | |
| $parent_slug = basename(get_permalink($post->post_parent)); | |
| array_push($classes, $parent_slug); | |
| //get the slug of the current page |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //finally have a function to check if we're anywhere on the damned blog and only the blog | |
| function is_blog() { | |
| if ( get_post_type() == 'post' || is_post_type_archive( 'post' ) ) { | |
| $blog = is_home() || is_archive() || is_single(); | |
| return $blog; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Hook into the single_template filter to use a custom template for one particular | |
| // post and still have it appear in the regular blog archives, featured posts, etc. | |
| // Template should be named 'single-[postID].php. | |
| add_filter('single_template', 'widget_custom_post'); | |
| function widget_custom_post($template) { | |
| global $post; | |
| // If it's the desired post, override the standard template with custom. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Checking in/out: | |
| $ git clone [project url] - get a copy of repo in a folder | |
| $ git checkout [file] - check out last committed version of a file | |
| $ git add --patch [file] - Step through each section of changes in a file with option to stage or not stage | |
| $ git remote rm origin - remove origin | |
| $ git remote add origin [url] - add origin | |
| Working with Branches: | |
| $ git branch [foo] - create branch named foo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Forked from jmlacroix/aws_cf_invalidate.rb | |
| # Modified to read s3 creds from the environment and the distribution id from arguments passed in. | |
| require 'rubygems' | |
| require 'hmac-sha1' | |
| require 'net/https' | |
| require 'base64' | |
| s3_access=ENV['S3_ACCESS'] | |
| s3_secret=ENV['S3_SECRET'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function calc_years_since($year) { | |
| $since = date("Y") - $year; | |
| if ($since == 1) { | |
| $since .= " year"; | |
| } else { | |
| $since .= " years"; | |
| } | |
| echo $since; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| In functions.php: | |
| function load_podcast_from_slug($slug) { | |
| echo "https://soundcloud.com/graphicdesignerpodcast" . $slug; | |
| } | |
| In single.php inside the loop: | |
| load_podcast_from_slug($post->post_name); |
OlderNewer