Skip to content

Instantly share code, notes, and snippets.

@pmgllc
pmgllc / wp-config
Created January 6, 2014 22:04
P2 multisite wp-config settings
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'subdomain.domain.com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);
@pmgllc
pmgllc / .htaccess
Created January 6, 2014 21:59
P2 multisite .htaccess
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
@pmgllc
pmgllc / media-queries.php
Created September 4, 2013 20:27
"Mobile first" methodology. Place the CSS query in function.php to call a mobile stylesheet to save bandwidth. That is the no-mq.css file. If viewed on a device larger than 480px, then it also calls a CSS file that includes a more traditional responsive stylesheet with media queries at the end, but geared for desktops at the top. I've also inclu…
<?php
/** Add in new media query stylesheets for functions.php */
// Add custom.css file in <head>
add_action('genesis_meta', 'pmg_add_customcss');
function pmg_add_customcss( ) {
$pmg_css_link = '
<link href="'.get_bloginfo( 'stylesheet_directory' ).'/no-mq.css" rel="stylesheet">
<!--[if (gte IE 9) | (IEMobile)]><!-->
<?php
add_filter( 'the_content', 'remove_breadcrum', 0 );
add_filter( 'the_content', 'add_breadcrum', 1000 );
function remove_breadcrum( $content ) {
add_filter( 'bbp_no_breadcrumb', '__return_true' );
return $content;
}
<?php
/* Plugin Name: Damn Vulnerable WordPress Plugin
* Description: Intentionally vulnerable plugin for plugin author education
* Version: 0.1
* Plugin URI: http://make.wordpress.org/plugins/2013/04/09/intentionally-vulnerable-plugin/
* Author: Jon Cave
* Author URI: http://joncave.co.uk
* License: GPLv2+
*
* DO NOT RUN THIS PLUGIN ON AN INTERNET ACCESSIBLE SITE
@pmgllc
pmgllc / viewport.php
Last active December 19, 2015 09:49
Genesis custom viewport - Genesis 2.0+ - HTML5 only
<?php
//* Add Viewport meta tag for mobile browsers (requires HTML5 theme support)
add_theme_support( 'genesis-responsive-viewport' );
@pmgllc
pmgllc / secureGoogle
Created June 20, 2013 17:14
Change Chrome default search to encrypted Google search
Go to the Settings page and click "Manage search engines" under the Search heading.
Scroll down below "Other search engines" to add a new search engine. Enter the following:
secureGoogle
https://encrypted.google.com
https://encrypted.google.com/search?hl=en&as_q=%s
Scroll up to find it in your list if you have a huge list and click "Make default" to make it appear in the top box and bolded.
Ideally, you'd be in Incognito mode for complete anti-cookie tracking on your system, but it's better than nothing.
@pmgllc
pmgllc / partial-plugin.php
Last active December 18, 2015 01:39
Stealth Login Page code snippet to add URL filter to logout/password reset. This will need to be added each time the plugin updates - add to plugin.php.
// After all network activate/deactivate sections, before Global Variables
/**
* Edit the logout/login/lost_password URLs to the new custom URL
*
* @since 2.1.0
* @param $old
* @param $new
* @param $url
* @return array
@pmgllc
pmgllc / gist:5453550
Last active December 16, 2015 15:09
Trying to add a "settings" link to my plugin. This is after looking at 5-10 plugins with a simple method that didn't work to now using what is in YOURLS and bbPress-Members Only: http://plugins.svn.wordpress.org/bbpress-members-only/trunk/init.php Still no link appears and die('foo'); at any point along here does show the function is being read.
<?php
// Start up the engine
final class SLPCreator {
static $instance;
function __construct() {
self::$instance =& $this;
// Actions
add_action( 'init', 'slp_load_plugin_translations', 1 );