Skip to content

Instantly share code, notes, and snippets.

View jlengstorf's full-sized avatar
💭
partyin

Jason Lengstorf jlengstorf

💭
partyin
View GitHub Profile
@jlengstorf
jlengstorf / related-posts.php
Last active August 29, 2015 14:06
A simple way to load related posts using WordPress categories.
@jlengstorf
jlengstorf / .gitignore
Created June 12, 2014 17:14
.gitignore
*~
.DS_Store
.svn
.cvs
*.bak
*.swp
Thumbs.db
Icon
Icon*
$ find . -type f -print | grep '.gitignore' | xargs grep -i 'yoast' # No results
$ git add wp-content/plugins/wordpress-seo/admin/class-yoast-notification-center.php
The following paths are ignored by one of your .gitignore files:
wp-content/plugins/wordpress-seo/admin/class-yoast-notification-center.php
Use -f if you really want to add them.
fatal: no files added
@jlengstorf
jlengstorf / deploy.php
Created May 16, 2014 17:31
An extremely basic Git deployment script.
<?php
// Removes any local changes to avoid errors with the pull
shell_exec("git reset --hard HEAD >> ../logs/deploy.log 2>&1");
// Pulls the latest changes from the develop branch
shell_exec("git pull -v origin develop >> ../logs/deploy.log 2>&1");
shell_exec("git submodule init >> ../logs/deploy.log 2>&1");
shell_exec("git submodule update >> ../logs/deploy.log 2>&1");

Modal Windows for WordPress

A relatively simple way to add responsive modal windows to a WordPress theme.

To install, add the JS/LESS to your child theme and drop the template in the root of your theme.

In the WordPress dashboard, create a new page and set it to the "Modal (Pop-Over)" template. Add any content here — HTML is allowed.

In the modal JS, set modal_window_uri to the new page's path.

nav {
&.navbar {
.navbar-header {
.navbar-toggle {
}
.navbar-brand {
}
}
@jlengstorf
jlengstorf / gruntfile.js
Last active August 29, 2015 14:00
Standard Grunt setup for a WordPress theme. Place in the theme's root.
module.exports = function(grunt) {
grunt.registerTask('watch', [ 'watch' ]);
grunt.initConfig({
uglify: {
options: {
mangle: true,
compress: true,
preserveComments: 'some'
@jlengstorf
jlengstorf / README.md
Last active August 29, 2015 13:57
A simple mix-in to handle `@font-face` loading.

LESS Mix-In for Web Fonts

This mix-in is a shortcut for the cumbersome @font-face declaration.

It assumes that all font files are stored in the same directory and share the same file name (e.g. font-name.eot, font-name.woff, etc.).

Usage

<?php
/**
* Retrieves the thumbnail URL to use for a post
* @param string $text The body of the post (get_content)
* @param string $size The image size to retrieve
* @return string The image URL to use
*/
function rw_get_thumb_url($text, $size){
global $post;
@jlengstorf
jlengstorf / .gitignore
Created December 17, 2013 20:11
WordPress .gitignore
.DS_Store
.ht*
/wp-*.php
xmlrpc.php
wp-admin/
wp-includes/
wp-content/index.php
wp-content/plugins/
wp-content/uploads/
wp-content/themes/index.php