Skip to content

Instantly share code, notes, and snippets.

View jjozwiak's full-sized avatar

Jason Jozwiak jjozwiak

View GitHub Profile
@jjozwiak
jjozwiak / .htaccess
Created December 2, 2017 09:54
.htaccess
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Force https
@jjozwiak
jjozwiak / gist:99f90bfcf1bdab985fa9
Created August 31, 2015 19:48
WP map route to callback function
function init_custom_routes() {
// Map a route to a function. Don't use a beginning or trailing /
$routes = array(
'gform/save' => 'custom_save_process',
);
$request_uri = trim($_SERVER['REQUEST_URI'], '/');
// Try to call the a function named the same as the value in the routes array.
@jjozwiak
jjozwiak / REGEX: URL
Created August 10, 2015 18:59
REGEX: URL
'/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/'
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
*/
$args = array(
@jjozwiak
jjozwiak / drupal.make
Created June 14, 2014 17:01
Drupal Make File
; Commands for setting up new drupal site
; ---------------
; mkdir newsite
; cd newsite
; drush make ../GA_Drupal.make -y
; drush site-install standard --db-url=mysql://root:root@localhost/local_newsite --site-name=NewSite --account-name=admin --account-pass=password
; ----------------
; ----------------
; Generated makefile from http://drushmake.me
Array
(
[hook_menu] => 6744
[hook_uninstall] => 4742
[hook_perm(ission)] => 4012
[hook_install] => 3751
[hook_theme] => 3525
[hook_schema] => 3003
[hook_help] => 2465
[hook_form_alter] => 2273
@jjozwiak
jjozwiak / WP_Login_Logo_Change
Last active November 15, 2017 18:28
wp_login_logo_change.php
// CUSTOM ADMIN LOGIN HEADER LOGO
function my_custom_login_logo()
{
echo '<style type="text/css"> h1 a { background-image:url('.get_bloginfo('template_directory').'/images/logo-connect.png) !important; margin-bottom:50px; background-size: 206px 69px !important; height: 90px !important; } </style>';
}
add_action('login_head', 'my_custom_login_logo');
@jjozwiak
jjozwiak / DRUPAL Bootstrap
Created June 28, 2013 02:41
DRUPAL Bootstrap
//Boostrap Drupal in standalone script file to access drupal functions
define('DRUPAL_ROOT', getcwd());
require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
@jjozwiak
jjozwiak / Drupal Drush
Created June 24, 2013 00:53
Drupal Drush
//Run make file
drush make-generate drupaldev.make name_of_directory
//Site install
drush site-install standard --account-name=admin --account-pass=admin --db-url=mysql://root:root@localhost/YourMySQLDatabase
@jjozwiak
jjozwiak / gist:5085371
Created March 4, 2013 20:31
htaccess redirect
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ http://www.redirecttopage.com [L,R=301]
RewriteBase /
</IfModule>