Skip to content

Instantly share code, notes, and snippets.

View markbain's full-sized avatar
๐ŸŽฏ
Focusing

Mark Bain markbain

๐ŸŽฏ
Focusing
View GitHub Profile

#My sample wp-config.php#

@markbain
markbain / readme.md
Last active August 29, 2015 14:24
My Sample .sublime-project

#My Sample .sublime-project#

@markbain
markbain / wp-setup.md
Last active December 30, 2015 08:42
WP Project setup checklist

WP Project setup checklist

Staging server

  • Configure sub-domain
  • Configure database

Local environment

  • Configure hosts

Install WordPress

@markbain
markbain / how-trello.md
Last active April 16, 2018 12:10
How I use Trello

How To Use This Board

Cards

  • Cards represent tasks (with one exception, cards in the Reference list).
  • Card titles should ideally contain a verb e.g. "Fix the apply button"
  • Card descriptions should outline the task in more detail.
  • Discussion related to the task should take place in the comments. This provides a record of decisions and the thought process surrounding the task.
  • Checklists should be used to detail the steps toward completion of the task.
  • Cards are not set in stone; whenever a task grows too big for a card, a new card can be created.
@markbain
markbain / no-thumb
Created March 18, 2015 15:22
Finds WP posts without featured
SELECT DISTINCT(p.ID), p.post_title, p.post_content FROM `wp_posts` p
LEFT JOIN wp_posts im ON p.ID = im.post_parent AND im.post_type = "attachment"
WHERE p.post_status ='publish'
AND p.post_type = "post"
AND im.ID IS NULL
AND p.post_content NOT REGEXP 'src=".*"'
@markbain
markbain / content-connected-reviews.php
Created December 28, 2014 13:44
WordPress snippet: show connected items, in this case "reviews".
<?php
$connected_reviews = new WP_Query( array(
'connected_type' => 'nice_stuff',
'connected_items' => get_queried_object(),
'nopaging' => true,
) );
if ( is_singular( 'portfolio_item' ) && $connected_reviews->have_posts() ) : ?>
<?php while ( $connected_reviews->have_posts() ) : $connected_reviews->the_post();
@markbain
markbain / Gruntfile.js
Created November 26, 2014 16:19
My WordPress theme project gruntfile.js
'use strict';
module.exports = function(grunt) {
// auto-load all grunt tasks matching the `grunt-*` pattern in package.json
require('load-grunt-tasks')(grunt); // no need for grunt.loadNpmTasks!
grunt.initConfig({
pkg: grunt.file.readJSON( 'package.json' ),
// watch for changes and trigger sass, jshint, uglify and livereload
@markbain
markbain / social sharing
Created June 6, 2014 14:18
Some social sharing stuff
global $wp_query;
$postid = $wp_query->post->ID;
// vars
$my_title = get_the_title();
$my_link = urlencode( get_permalink() );
$my_image = wp_get_attachment_image_src( get_post_thumbnail_id( $postid ), 'full' );
echo '<p class="social-title">Share this article</p>';
echo '<ul class="social-media social-media--share">';
@markbain
markbain / Change WP custom tax name
Created June 6, 2014 05:21
Update the name of a WordPress custom taxonomy in the database
UPDATE 'wp_term_taxonomy' SET 'taxonomy' = 'NEW_TAX_NAME' WHERE 'taxonomy' = 'OLD_TAX_NAME';
@markbain
markbain / New CPT name
Created June 6, 2014 05:20
Change name of WordPress custom post type in database
UPDATE `wp_posts` SET `post_type` = 'NEW_CPT_NAME' WHERE `post_type` = 'OLD_CPT_NAME';