Skip to content

Instantly share code, notes, and snippets.

View dirtystylus's full-sized avatar

Mark Llobrera dirtystylus

View GitHub Profile
@dirtystylus
dirtystylus / gist:b8f9bbcc1fce28670b8e
Last active August 29, 2015 14:04
WordPress Custom Login Screen
/**
* Implement Custom Admin Logo
*/
function new_custom_login_logo() {
echo '<style type="text/css">
h1 a { background-image:url('.get_template_directory_uri().'/images/THEME-LOGO.png) !important; width:321px !important; height: 243.56px !important; background-size: 321px 243.56px !important; }
</style>';
}
add_action('login_head', 'new_custom_login_logo');
@dirtystylus
dirtystylus / wp-tinymce-remove
Last active August 29, 2015 14:05
Removing TinyMCE options in WordPress
/*
* This goes in your theme’s functions.php file.
* This will remove EVERY option in the basic WYSIWYG bar in WP. Pull items out of the $remove array if you want to keep them.
*/
function myplugin_tinymce_buttons($buttons)
{
//Remove the format dropdown select and text color selector
$remove = array('bold','italic','blockquote','strikethrough','bullist','numlist','hr','alignleft','aligncenter','alignright','link','unlink','wp_more','spellchecker','wp_fullscreen','wp_adv');
return array_diff($buttons,$remove);
@dirtystylus
dirtystylus / acf-flexible-content-field
Created September 4, 2014 02:15
ACF with Flexible Content Field
<?php
/**
* @package modularcontent
*/
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content">
<?php
// check if the flexible content field has rows of data
if( have_rows('flexible_content') ):
@dirtystylus
dirtystylus / gist:34a65ab232ac21222380
Created September 11, 2014 23:33
Drupal 7: Remove Image Width and Height
function mytheme_preprocess_image(&$variables) {
foreach (array('width', 'height') as $key) {
unset($variables[$key]);
}
}
@dirtystylus
dirtystylus / wp-remove-text-tab-buttons
Created September 16, 2014 20:35
WordPress Remove Text Tab Buttons
function _remove_quicktags( $qtInit )
{
// Remove only the 'italic', 'bold', and 'block-quote' buttons
$remove_these = array('strong', 'em', 'block', 'link', 'del', 'ins', 'img', 'ul', 'ol', 'li', 'code', 'more', 'close');
// Convert string to array
$buttons = explode(',', $qtInit['buttons']);
// Loop over items to remove and unset them from the buttons
for( $i=0; $i < count($remove_these); $i++ )
{
if( ($key = array_search($remove_these[$i], $buttons)) !== false)
@dirtystylus
dirtystylus / css-reset-box-sizing
Created November 12, 2014 15:35
CSS Reset with Box Sizing
/* CSS reset with box-sizing fix */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
precomposeunicode = true
[remote "github"]
url = GITHUB REMOTE REPO URL HERE
fetch = +refs/heads/*:refs/remotes/github/*
name = Custom Beans
description = My Custom Beans
core = 7.x
files[] = "custom_bean.listing.inc"
<?php
/**
* This snippet adds extra classes to Drupal
* menu leafs (li tags) and menu itself (ul tags).
*/
/**
* Since the standard preprocess function for menu tree, which is
* template_preprocess_menu_tree, located in includes/menu.inc,
# Markdown Lists and Headers
## Single List Item
* ## List Item Header
## Two List Items
* ## List Item Header
* sub-item