Skip to content

Instantly share code, notes, and snippets.

View lordmatt's full-sized avatar

Matthew lordmatt

View GitHub Profile
@lordmatt
lordmatt / NP_ItemLicense.php
Last active December 15, 2015 14:49
This is a fork of Graeme Cook's 0.1.0 ItemLicense plugin for NucleusCMSwhich can be found here: http://wakka.xiffy.nl/itemlicense_code The purpose of the fork is to make changes including depreciating all support for PHP4 and standardised on PHP5 style coding. Also it means that his code is available on github.
<?php
/**
* Apply a license of your choice to NucleusCMS blogs on an item-by-item basis.
*
* Copyright (C) ???? Graeme Cook, 2013 Matthew Brown aka Lord Matt
*
* 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 3 of the License, or
@georgiecel
georgiecel / wp-comment-walker
Last active December 28, 2022 15:16
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">
@umidjons
umidjons / pdf-thumbnail-php.md
Last active December 6, 2023 21:41
Creating PDF thumbnails in PHP

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

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

@MarquisLP
MarquisLP / pygame_test.py
Last active December 3, 2022 17:50
A simple game loop for testing PyGame code.
"""This module contains all of the necessary PyGame components for
running a simplified game loop.
Use it for test cases on PyGame-related code.
"""
import sys
import pygame
from pygame.locals import *
# Import additional modules here.
@Trippnology
Trippnology / comments.php
Created October 12, 2015 13:36
WP: Add Bootstrap classes to comment form
// Add to your theme's comments.php
<?php
$comment_args = array(
'class_submit' => 'btn btn-default submit',
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label> <textarea id="comment" name="comment" class="form-control" cols="45" rows="8" aria-required="true" required="required"></textarea></p>',
'fields' => array(
'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
'<input id="author" name="author" class="form-control" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . $html_req . ' /></p>',
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
'<input id="email" name="email" class="form-control" ' . ( $html5 ? 'type="email"' : 'type="text"' ) . ' value="' . esc_attr( $commenter['comment_auth
<?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.
@modemlooper
modemlooper / php
Created January 29, 2016 21:40
Example on adding a page to user profile
<?php
/**
* Plugin Name: BP Add Page
* Plugin URI: https://webdevstudios.com
* Description: Example on adding a page to BuddyPress profiles
* Author: WebDevStudios
* Author URI: https://webdevstudios.com
* Version: 1.0.0
* License: GPLv2
*/
@mikoj
mikoj / Singleton.php
Last active May 12, 2022 14:33
php7 Singleton final private __construct
<?php
interface ISingleton {
public static function getInstance(): ISingleton;
}
abstract class Singleton implements ISingleton {
private static $_instances = [];
final private function __construct () {}
@ajskelton
ajskelton / WP Customizer - Checkbox
Last active May 14, 2024 04:54
Add a Checkbox field to the WordPress Customizer.
$wp_customize->add_setting( 'themecheck_checkbox_setting_id', array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'themeslug_sanitize_checkbox',
) );
$wp_customize->add_control( 'themeslug_checkbox_setting_id', array(
'type' => 'checkbox',
'section' => 'custom_section', // Add a default or your own section
'label' => __( 'Custom Checkbox' ),
'description' => __( 'This is a custom checkbox input.' ),