Skip to content

Instantly share code, notes, and snippets.

View johnheimkes's full-sized avatar
🤝
Looking for work!

John Heimkes IV johnheimkes

🤝
Looking for work!
  • Minneapolis, MN
View GitHub Profile
@johnheimkes
johnheimkes / functions.php
Last active February 20, 2019 19:00 — forked from mustardBees/functions.php
Add &rel=0 to Youtube oembed videos
<?php
/**
* Filter YouTube oEmbed to include '&rel=0' to force channel related videos
* once video is complete, rather than showing user related videos.
*
* @param $html
* @param $url
* @param $args
*
* @return mixed
@johnheimkes
johnheimkes / gist:5aa923e56eb6eab58221
Created May 27, 2015 22:18
WordPress child page submenu & ancestors
<?php
$ancestors = get_post_ancestors($post->ID);
if (empty($ancestors)) {
$last_ancestor = $post->ID;
} else {
$last_ancestor = $ancestors[count($ancestors) - 1];
}
?>
@johnheimkes
johnheimkes / gist:e7f9bceb8d86b60e03d3
Created October 24, 2014 20:25
Paginate links with custom WP_Query
<?php
$big = 999999999;
echo paginate_links( array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '/page/%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $my_query->max_num_pages,
'prev_text' => __( 'Previous' ),
'next_text' => __( 'Next' ),
<?php
function ag_show_me_hooks() {
global $wp_current_filter;
var_dump( $wp_current_filter );
}
add_action( 'all', 'ag_show_me_hooks' );
@johnheimkes
johnheimkes / gist:10903189
Created April 16, 2014 16:29
Easy RSS feed
<?php
$rss = new DOMDocument();
$rss->load( 'http://wordpress.org/news/feed/' );
$feed = array();
foreach ( $rss->getElementsByTagName( 'item' ) as $node ) {
$item = array(
'title' => $node->getElementsByTagName( 'title' )->item(0)->nodeValue,
'link' => $node->getElementsByTagName( 'link' )->item(0)->nodeValue,
<!--
.,;+###+;:.
.##;` .'@:
`@+ +#
#' `@`
`@` `@
``:::.` @. +.
`#+` ;@ `# '.
`@ `@ :; @
@` @; +
@johnheimkes
johnheimkes / Quick LAMP Install
Created April 9, 2013 19:00
After spinning up a new debian instance, use these couple commands to quickly install the rest of your LAMP stack.
# First run an apt-get update to be sure everything is good
# Install tasksel
sudo apt-get install tasksel
# Now install LAMP
sudo tasksel install lamp-server
# Success! Have some whiskey.
# Do the following command
# Ref: http://soderlind.no/archives/2011/08/26/running-wordpress-locally-on-mac-os-x-lion/
# Chown / Chmod site directory
$ sudo chown -R :_www [site_directory]
$ sudo chmod -R g+w [site_directory]
# Add to "wp-config.php"
define('FS_METHOD', 'direct');
<?php
/**
* My Project
*
* @package MyProject
* @subpackage JesGs_Walker_Category
* @author Jess Green <[email protected]>
* @version $Id$
*/
@johnheimkes
johnheimkes / index.html
Created November 15, 2012 16:34
A CodePen by John Heimkes IV. CSS Swinging Panel Menu - A simple, clean pure CSS menu that uses keyframe animation to create a "swining panel" effect for sub nav. I am having trouble getting it to work in Opera but performs well in Chrome, Safari and Fire
<div id="container">
<ul id="menu">
<li><a href="#">About Me</a>
<ul>
<li><a href="#">Lorem ipsum dolor</a></li>
<li><a href="#">Maecenas lacinia sem</a></li>
<li><a href="#">Suspendisse fringilla</a></li>
</ul>
</li>
<li><a href="#">Portfolio</a>