Skip to content

Instantly share code, notes, and snippets.

View dotherightthing's full-sized avatar

Dan Smith dotherightthing

  • Do The Right Thing
  • Wellington, New Zealand
View GitHub Profile
@dotherightthing
dotherightthing / importing-posts-with-duplicate-ids.md
Created August 15, 2019 08:57
[Importing posts with duplicate IDs] #wordpress

Importing posts with duplicate IDs

Created: 2017.04.17

After creating my pages, I realised that I was working off a new database..

I'd forgotten to import the old database, containing the existing posts.

I opened the new and old databases up in SequelPro and was unhappy to find that some of the IDs clashed.

@dotherightthing
dotherightthing / template-tags-vs-shortcodes.md
Created August 15, 2019 08:59
[Template Tags vs Shortcodes] #wordpress

Template Tags vs Shortcodes

Created: 2017.04.16

Template tags are used within your blog's Templates to display information dynamically or otherwise customize your blog, providing the tools to make it as individual and interesting as you are.

Template tags files are stored in the wp-includes directory. The files have the suffix of "-template.php" to distinguish them from other WordPress files. There are 9 template tags files:

@dotherightthing
dotherightthing / offline-codex.md
Last active August 15, 2019 09:05
[Offline Codex] #wordpress

Offline Codex

Created: 2017.04.13

Dash gives your Mac instant offline access to 150+ API documentation sets (including the WordPress Codex).

Dash is an API Documentation Browser and Code Snippet Manager. Dash stores snippets of code and instantly searches offline documentation sets for 150+ APIs (for a full list, see below). You can even generate your own docsets or request docsets to be included.

@dotherightthing
dotherightthing / migrating-to-multisite.md
Created August 15, 2019 09:06
[Migrating to multisite] The steps required to perform a migration. #wordpress

Migrating to multisite

Created: 2017.04.15

wp-config.php

Add this block, replacing NETWORK_DOMAIN.FOO:

define( 'WP_ALLOW_MULTISITE', true );
@dotherightthing
dotherightthing / disable-ds_store.md
Last active August 15, 2019 09:11
[Disabling .DS_Store] #macos

Disabling .DS_Store

Created: 2017.04.14

MacOS creates .ds_store files to store meta data about folders.

The preceding dot causes DS_Store files to be hidden from the user, even after showing hidden files.

However these files are flagged by the WordPress Theme Check plugin:

@dotherightthing
dotherightthing / object-literals.md
Created August 15, 2019 09:13
[Object literals] Understanding and viewing Object literals. #javascript
@dotherightthing
dotherightthing / installing-composer-and-phpunit.md
Created August 15, 2019 09:14
[Installing Composer & PHPUnit] Installing Composer so I can install PHP Unit for WordPress plugin testing. #php

Installing Composer & PHPUnit

Created: 2017.04.15

I have been looking at PHPUnit which seems like a great way of creating automated tests. However, it seems to be geared towards object oriented code, are there any alternatives for procedural code? You can test procedural code with PHPUnit. Unit tests are not tied to object-oriented programming. They test units of code. In OO, a unit of code is a method. In procedural PHP, I guess it's a whole script (file). While OO code is easier to maintain and to test, that doesn't mean procedural PHP cannot be tested. ...

@dotherightthing
dotherightthing / building-a-codepen.md
Created August 15, 2019 09:16
[Building a CodePen] #javascript

Building a CodePen

Created: 2017.04.13

CodePen is great, but an embedded shortcode is not great from an authoring perspective. Is there a better way to integrate snippet authoring into WordPress?

Ace is an embeddable code editor written in JavaScript. It matches the features and performance of native editors such as Sublime, Vim and TextMate. It can be easily embedded in any web page and JavaScript application.

@dotherightthing
dotherightthing / adding-custom-fields-to-the-wordpress-category-interface.md
Created August 15, 2019 09:17
[Adding Custom Fields To The WordPress Category Interface] #wordpress

Adding Custom Fields To The WordPress Category Interface

Created: 2017.04.12

@dotherightthing
dotherightthing / xhr.md
Created August 15, 2019 09:19
[XHR] #javascript #glossary

XHR

Created: 2017.04.12

XMLHttpRequest (Ajax)