Skip to content

Instantly share code, notes, and snippets.

View lordmatt's full-sized avatar

Matthew lordmatt

View GitHub Profile
<?php
/*
* This is an example of adding activity to a BuddyPress group.
*
* I cribbed it pretty much wholesale from EGB
* @link https://github.com/lordmatt/external-group-blogs/
*
* You will almost certainly need to do some work and testing
* to get something useful from this code.
*
@lordmatt
lordmatt / wp-comment-walker
Created September 12, 2019 02:39 — forked from georgiecel/wp-comment-walker
Custom comment walker for HTML5 friendly WordPress comment and threaded replies. To be inserted in functions.php.
<?php
class comment_walker extends Walker_Comment {
var $tree_type = 'comment';
var $db_fields = array( 'parent' => 'comment_parent', 'id' => 'comment_ID' );
// constructor – wrapper for the comments list
function __construct() { ?>
<section class="comments-list">
@lordmatt
lordmatt / guest-meta.php
Last active August 11, 2019 16:58
Guest Meta for WordPress - allows you to store meta-data for guests just like you would for users.
<?php
/*
Plugin Name: Guest Meta
Plugin URI: <https://gist.github.com/lordmatt/3bd8f7787fbbe0950f9228dec92f2f8a>
Description: Enable storing meta data for guests. Keeps cookies small and simple.
Author: Matthew Brown
Author URI: http://matthewdbrown.authorbuzz.co.uk/
Version: 1.1.0
License: GPLv3 or later
Text Domain: guest_meta
@lordmatt
lordmatt / datastore.php
Last active August 11, 2019 16:38
A work in progress abstraction that will allow user meta for all users including guests. Please contribute.
<?php
namespace storyteller;
/**
* This is a class designed to be used in WordPress Plugins and Themes where for
* whatever reason, the designer wishes to track a huge ammount of per-user data
* and keep it well ordered and accessable.
*
* I am posting this in an incomplete state; in the hope that further developers
* might have ideas that will finish the project for the good of the community.
@lordmatt
lordmatt / WP-fun-with-headers.php
Created April 16, 2019 16:49
This is an example of doing silly things with headers in WordPress
<?php
/**
* This is an example of doing silly things with headers in WordPress
*
* @author Lord Matt <http://lordmatt.co.uk>
*/
function fun_with_headers(){
<?php
/*
* Problem
* -------
*
* I needed a set of undefined size of card layouts on a 5x5 grid that were
* rotationally unique from each other. This data had to be as CSV lines in a
* file.
*
<?php
/*
Matt's Word Bingo generator script.
Copyright (C) 2017 Matthew D Brown
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
<?php
/**
* --------------------------------------------------------------
* Contact Form To Email Demo
* Copyright (C) 2015 Lord Matt <lordmatt.co.uk>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.

Creating PDF thumbnails in PHP

Install Ghostscript

Download and install right version of ghostscript. In my case my PHP was x86 architecture, so I download Ghostscript 9.14 for Windows (32 bit).

Enable ImageMagick