Skip to content

Instantly share code, notes, and snippets.

View benklocek's full-sized avatar

Ben Klocek benklocek

View GitHub Profile
@benklocek
benklocek / gist:4062437
Created November 12, 2012 22:30
Wordpress Functions: Add Style Dropdown to TinyMCE
// Add the Style Dropdown Menu to the second row of visual editor buttons
function bracia_mce_buttons_2($buttons){
array_unshift($buttons, 'styleselect');
return $buttons;
}
add_filter('mce_buttons_2', 'bracia_mce_buttons_2');
function bracia_tiny_mce_before_init( $settings ) {
$style_formats = array(
// array(
@benklocek
benklocek / include-regex.php
Created May 30, 2011 20:11
Regex for fixing absolute URL includes
$pattern = '<\?(\s?include\("?)(http:\/\/www\.domain\.com)(.*?\.php)(.*\n?)';
$subject = "<?php include($_SERVER['DOCUMENT_ROOT'] . '$3';) ?>";
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
// For 403 @ /admin/settings/customerror
// Title: Access Denied
<?php global $user; // http://www.kinetasystems.com/blog/creating-custom-error-pages-in-drupal ?>
<?php if ($user->uid): ?>
<p>Sorry <?php print $user->name; ?>, you don't have permission to view the page you've just tried to access.</p>
<p>If you feel that you have received this message in error, please
<a href="/about">contact us</a> with specific details so that we may review your access to this web site.</p>
<p>Thanks</p>
<?php else: ?>
<p>This page may be available to clients and registered users only. Please select from one of the other options available to you below.</p>