Skip to content

Instantly share code, notes, and snippets.

@brasofilo
brasofilo / manage-debug-log.php
Created May 30, 2013 03:33
Manage Debug Log
<?php
/**
* Plugin Name: Manage Debug Log
* Plugin URI: http://brasofilo.com/manage-debug-log
* Description: Adds a settings page to view and clear the Debug Log (/wp-content/debug.log)
* Version: 1.0
* Author: Rodolfo Buaiz
* Network: true
* Author URI: http://wordpress.stackexchange.com/users/12615/brasofilo
<input type="text" name="my-theme-options[color]" id="color" />
<input type='button' class='pickcolor button-secondary' value='Select Color'>
<div id='colorpicker' style='z-index: 100; background:#eee; border:1px solid #ccc; position:absolute; display:none;'></div>
// Color Picker for js file
$('.pickcolor').click( function(e) {
colorPicker = jQuery(this).next('div');
input = jQuery(this).prev('input');
$(colorPicker).farbtastic(input);
colorPicker.show();
<?php
/**
* Custom browser check
*
* Uses https://github.com/cbschuld/Browser.php
*/
function b5f_browser_check($what) {
global $browser, $browver;
switch ($what) {
@brasofilo
brasofilo / folders-sizes-dashboard-widget.php
Last active December 23, 2015 19:08
WordPress Dashboard Widgets to calculate the size of the folders in root and wp-content. Used in the plugin Admin Tweaks.
<?php
/**
* Plugin Name: Calculate Folders Sizes
* Plugin URI: http://wordpress.org/extend/plugins/many-tips-together
* Description: Dashboard widgets to calculate the size of the folders in root and wp-content. Used in the plugin Admin Tweaks.
* Version: 1.0
* Author: Rodolfo Buaiz
* Author URI: http://brasofilo.com/
* Text Domain: mtt
* License: GPLv2 or later
@brasofilo
brasofilo / paste-in-plugin.css
Created September 30, 2013 21:10
Admin Tweaks custom CSS
html, body {
min-height: 100%;
}
body {
background: #d8e0de;
background: -moz-linear-gradient(top, #d8e0de 0%, #aebfbc 22%, #99afab 33%, #8ea6a2 50%, #829d98 67%, #4e5c5a 82%, #0e0e0e 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#d8e0de), color-stop(22%,#aebfbc), color-stop(33%,#99afab), color-stop(50%,#8ea6a2), color-stop(67%,#829d98), color-stop(82%,#4e5c5a), color-stop(100%,#0e0e0e));
background: -webkit-linear-gradient(top, #d8e0de 0%,#aebfbc 22%,#99afab 33%,#8ea6a2 50%,#829d98 67%,#4e5c5a 82%,#0e0e0e 100%);
background: -o-linear-gradient(top, #d8e0de 0%,#aebfbc 22%,#99afab 33%,#8ea6a2 50%,#829d98 67%,#4e5c5a 82%,#0e0e0e 100%);
background: -ms-linear-gradient(top, #d8e0de 0%,#aebfbc 22%,#99afab 33%,#8ea6a2 50%,#829d98 67%,#4e5c5a 82%,#0e0e0e 100%);
@brasofilo
brasofilo / widget-title-with-urls.php
Created October 1, 2013 19:19
Using URLs in Widget Titles. Using the format TITLE||URL||TARGET, being target optional. Nice article with many methods: http://www.rvamedia.com/wordpress/customize-wordpress-widget-title
<?php
add_filter( 'widget_title', function( $title )
{
$pieces = explode( '||', $title );
if( isset( $pieces[1] ) )
{
$target = isset( $pieces[2] ) ? "target='{$pieces[2]}'" : '';
$new_title = sprintf(
"<a href='%s' %s>%s</a>",
$pieces[1],
@brasofilo
brasofilo / fix-backwpup-mp6-icon.php
Last active December 25, 2015 04:09
Fix BackWPUp icon for MP6
<?php
/**
* Plugin Name: Fix BackWPUp MP6 menu icon
*/
add_action( 'plugins_loaded', function()
{
if( ( !is_multisite() || is_network_admin() ) && defined( 'MP6' ) )
{
add_action(
'admin_head',
@brasofilo
brasofilo / publish-to-network.php
Last active December 25, 2015 20:39
Meta box that allows publishing a post to another site of the network
<?php
/**
* Plugin Name: Publish to Network
* Plugin URI: https://gist.github.com/brasofilo/7036415
* Description: Meta box that allows publishing a post to another site of the network
* Version: 1.0
* Author: Rodolfo Buaiz
* Author URI: http://wordpress.stackexchange.com/users/12615/brasofilo
* Text Domain: sepw
* Domain Path: /languages
@brasofilo
brasofilo / dashboard-widget.md
Last active December 26, 2015 01:49
dashboard-widget.md

#Widget de Escritorio con Callback Handle ###--WordPress Plugin--

Demonstración de como añadir un widget de escritorio configurable. Elije 3 páginas y serán mostradas en pestañas. Basado en el ejemplo del Codex y en el artículo Tabbed Meta Box In WordPress.

@brasofilo
brasofilo / admin-block.md
Last active December 26, 2015 02:09
admin-block.md

#Bloquear Acceso Administrativo para Ciertos Roles

Basado en esta [WordPress Answer][1]
<?php
/**
 * Plugin Name: Bloquear Acceso Administrativo para Ciertos Roles
 * Version: 0.2
 * Author: Rodolfo Buaiz 
 * Plugin URI: http://wordpress.stackexchange.com/q/57206/12615