Skip to content

Instantly share code, notes, and snippets.

View peterhebert's full-sized avatar

Peter Hebert peterhebert

View GitHub Profile
@peterhebert
peterhebert / CustomPost.php
Created March 23, 2018 16:17 — forked from dobbyloo/CustomPost.php
Wordpress: custom post wrapper class for "register_post_type" function.
<?php namespace PaintedCloud\WP\Classes;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class CustomPost {
protected $textdomain;
protected $posts;
public function __construct( $textdomain )
@peterhebert
peterhebert / srcset-https.php
Created December 27, 2019 16:47
Force URLs in srcset attributes into HTTPS scheme
/*
* Force URLs in srcset attributes into HTTPS scheme.
* This is particularly useful when you're running a Flexible SSL frontend like Cloudflare
*/
function ssl_srcset( $sources ) {
foreach ( $sources as &$source ) {
$source['url'] = set_url_scheme( $source['url'], 'https' );
}
return $sources;