Skip to content

Instantly share code, notes, and snippets.

View mattclements's full-sized avatar

Matt Clements mattclements

View GitHub Profile
<?php
//MODIFIED HEADER DATE
##################################################################################
function set_headerdate() {
$format = "%a, %d %b %Y %H:%M:%S %z";
// First check if there is a blog post date
if (function_exists('perch_blog_post_field') && function_exists('perch_get') && perch_blog_post_field(perch_get('s'), 'postDateTime', true)) {
$result = perch_blog_post_field(perch_get('s'), 'postDateTime', true);
header("Last-Modified: ".strftime($format, strtotime($result)));
@mattclements
mattclements / DB.php
Created September 24, 2015 08:05
DB Class
<?php
class DB
{
private $_dbname;
private $_dbhost;
private $_dbuser;
private $_dbpass;
private $_dbcon;
@mattclements
mattclements / function.php
Last active February 16, 2026 07:12
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
@mattclements
mattclements / app.js
Created January 8, 2017 09:37
Doorbell
function send_pushover_notification() {
var push = require( 'pushover-notifications' );
var p = new push( {
user: "xxxx",
token: "xxxx"
});
var msg = {