Skip to content

Instantly share code, notes, and snippets.

View mojowill's full-sized avatar
:octocat:

Will Wilson mojowill

:octocat:
View GitHub Profile
@mojowill
mojowill / redmine.php
Created June 11, 2017 17:41
Github to Remine
<?php
// Github Details
$github_org = 'organisation'; //Github Organisation Name
$github_repo = 'repository'; //Github Repository Name
$github_user = 'username'; //Github Username
$github_password = 'password'; //Github Password
// Get from Github
$issues_url = "https://$github_user:[email protected]/repos/$github_org/$github_repo/issues?state=closed?per_page=100&quot;;
@mojowill
mojowill / wordpress-css-1.php
Created June 11, 2017 17:44
WordPress CSS 1
<?php
function global_css() {
wp_register_style( 'parent_main', get_template_directory_uri() . '/css/main.css', false, null, 'screen' );
wp_register_style( 'child_main', get_stylesheet_directory_uri() . '/style.css', false, null, 'screen' );
if ( ! is_admin() ) :
wp_enqueue_style( 'parent_main' );
endif;
@mojowill
mojowill / wordpress-css-2.php
Created June 11, 2017 17:45
WordPress CSS 2
<?php
function global_css() {
wp_register_style( 'parent_main', get_template_directory_uri() . '/css/main.css' , filemtime( get_template_directory() . '/css/main.css' ), null, 'screen' );
wp_register_style( 'child_main', get_stylesheet_directory_uri() . '/style.css' , filemtime( get_stylesheet_directory() . '/style.css' ), null, 'screen' );
if ( ! is_admin() ) :
wp_enqueue_style( 'parent_main' );
endif;
@mojowill
mojowill / dl-file.php
Last active September 22, 2017 12:42
Secure Gravity Forms uploads
<?php
require_once('wp-load.php');
is_user_logged_in() || auth_redirect();
$upload_dir = wp_upload_dir();
//Set your path below I am using /gravity_forms/
$basedir = $upload_dir['basedir'] . '/gravity_forms/';
$file = rtrim($basedir, '/') . '/' . str_replace('..', '', isset($_GET['file']) ? $_GET['file'] : '');
if (!$basedir || !is_file($file)) {
status_header(404);