Skip to content

Instantly share code, notes, and snippets.

View marcjenkins's full-sized avatar

Marc Jenkins marcjenkins

View GitHub Profile
@marcjenkins
marcjenkins / Redirect Template
Created September 17, 2013 16:11
WordPress template that directs page to first child.
<?php
/* Template Name: Redirect */
?>
<?php
$args = array('child_of'=>get_the_ID(), 'sort_column'=>'menu_order', 'sort_order'=>'ASC');
$pages = get_pages($args);
$first_child = $pages[0]->ID;
$link = get_permalink($first_child);
?>
@marcjenkins
marcjenkins / .htaccess
Created September 17, 2013 19:18
Quick and easy way to create a htaccess file for multiple WordPress domains.
<IfModule mod_rewrite.c>
RewriteRule . - [E=rwbase:/]
RewriteCond %{HTTP_HOST} localhost$
RewriteRule . - [E=rwbase:plausiblethought/]
RewriteCond %{HTTP_HOST} staging.plausiblethought.co.uk$
RewriteRule . - [E=rwbase:plausiblethought/]
RewriteEngine On
RewriteBase /%{ENV:rwbase}
RewriteRule ^index\.php$ - [L]
@marcjenkins
marcjenkins / create-blog-post.bash
Created September 17, 2013 19:23
Quick and dirty bash script for creating new Kirby blog posts with Alfred.
# cd to blog folder
cd ~/Sites/plausiblethought/content/blog/
# count files
COUNT=$(ls | wc -l)
# make folder (e.g. 10-test)
mkdir $COUNT-{query}
# cd to folder created above
Testing Slogger
@marcjenkins
marcjenkins / .bash_profile
Created January 14, 2014 14:18
My .bash_profile cobbled together from numerous sources.
# Easier navigation
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
# Shortcuts
alias brewup='brew update && brew upgrade && brew cleanup && brew doctor'
alias ping='ping -c 1'
alias ls='ls -lA'
alias d='cd ~/Dropbox'
<?php
function shortcodeButton( $atts, $content = null ) {
return '<a href="' . get_bloginfo('url') . '/contact/" class="btn">' . $content .' </a>';
}
add_shortcode('button', 'shortcodeButton');
<?php
function shortcodeButton( $atts, $content = null ) {
extract( shortcode_atts( array(
'link' => 'contact/',
'colour' => 'green'
), $atts ) );
return '<a href="' . "{$link}" . '" class="btn btn-' . "{$colour}" . '">' . $content . ' </a>';
}
<div class="grid container">
<div class="unit half">.unit.half</div>
<div class="unit half">.unit.half</div>
<div class="unit one-third">.unit.one-third</div>
<div class="unit one-third">.unit.one-third</div>
<div class="unit one-third">.unit.one-third</div>
<div class="unit one-quarter">.unit.one-quarter</div>
<div class="unit one-quarter">.unit.one-quarter</div>
<div class="unit one-quarter">.unit.one-quarter</div>
<div class="unit one-quarter">.unit.one-quarter</div>
@marcjenkins
marcjenkins / .gitignore
Created April 17, 2014 17:36
.gitignore for MODX projects
# ignore everything in this directory
/*
# but not these
!.gitignore
!assets/
!core/
!_SASS/
!_JS/
@marcjenkins
marcjenkins / .gitignore
Last active February 18, 2020 16:57
.gitignore for WordPress projects
# Thanks to: https://gist.github.com/jdbartlett/444295
# Ignore everything in the root except the "wp-content" directory.
/*
!.gitignore
!wp-content/
# Ignore everything in the "wp-content" directory, except the "plugins" and "themes" directories.
wp-content/*
!wp-content/plugins/