Skip to content

Instantly share code, notes, and snippets.

@miziomon
miziomon / the_filters
Created January 29, 2014 08:13
Get WordPress filters attach to specific hook
/**
* get filters attach to specific hook
* eg. the_filters("the_title");
*/
function the_filters($hook = '') {
global $wp_filter;
if (empty($hook) || !isset($wp_filter[$hook]))
return;
echo '<pre>';
@miziomon
miziomon / gist:4467983
Created January 6, 2013 15:41
My WordPress robot.txt
User-agent: *
Disallow:
Disallow: /blackhole/*
Disallow: /cgi-bin/
Disallow: /bin/
Disallow: /wp-includes/
Disallow: /wp-content/
Disallow: /wp-admin/
Disallow: /app/
@miziomon
miziomon / shortcode-navmenu.php
Created September 14, 2012 12:12
Hook to implement shortcode logic inside WordPress nav menu items
<?php
/**
* Hook to implement shortcode logic inside WordPress nav menu items
* Shortcode code can be added using WordPress menu admin menu in description field
*/
function shortcode_menu( $item_output, $item ) {
if ( !empty($item->description)) {
$output = do_shortcode($item->description);
@miziomon
miziomon / mysql2mail
Created September 13, 2012 08:54
MySql dump + zip + mail
mysqldump -u[user] -p[password] [dbname]| gzip --best -c > [dbname].sql.gz && (date && echo "[mail subjext]" && uuencode [dbname].sql.gz ) | mail [mail] -s "[mail subjext]"
@miziomon
miziomon / composer.json
Created July 31, 2012 15:26
WordPress MonoLog integration
{
"require": {
"monolog/monolog": "1.1.*"
}
}
@miziomon
miziomon / parent_metabox.php
Created July 24, 2012 12:58
WordPress custom metabox implementation
<?php
/**
* parent metabox implementation
*/
// hook
add_action( 'add_meta_boxes', 'CustomMetabox_setup' );
/**
@miziomon
miziomon / .htaccess | custom admin installation
Created June 27, 2012 10:54
WordPress secure .htaccess
Options All -Indexes
<files .htaccess>
Order allow,deny
Deny from all
</files>
<files wp-config.php>
Order allow,deny
Deny from all
@miziomon
miziomon / gist:2906618
Created June 10, 2012 17:00
pear common command
pear config-set auto_discover 1
pear clear-cache
pear update-channels
pear remote-list
pear upgrade pear
pear -V
@miziomon
miziomon / RequirePlugins.php
Created June 6, 2012 12:14
Developers Helper to check WordPress required plugins. If a required plugin not exist will be displayed an admin notice with plugin install link
if ( !class_exists( 'RequirePlugins' ) ):
class RequirePlugins {
private $require_plugins = array();
private $miss_plugins = array();
private $found_plugins = array();
function __construct( $require_plugins = null ) {
if (is_array( $require_plugins )) {
@miziomon
miziomon / class-formfields.php
Created May 11, 2012 16:30
Helper Class to render html form element width WordPress data
<?php
/*
* Mvd_FormFields
* Helper Class to render html form element width WordPress data
* NOTE: Designed for use with WordPress
* @author Maurizio Pelizzone
* @link http://maurizio.mavida.com
* @license: GPLv2 or later
* @License URI: http://www.gnu.org/licenses/gpl-2.0.html