Skip to content

Instantly share code, notes, and snippets.

View eduardopintor's full-sized avatar

Eduardo Pintor eduardopintor

View GitHub Profile
@eduardopintor
eduardopintor / phpcs
Last active March 9, 2017 16:04
CodeSniffer Report
phpcs --standard=IW -v --report=summary --report-file=/path/to/report-fle /path/to/code/
@eduardopintor
eduardopintor / emergency.php
Created April 5, 2017 18:00
Emergency Password Reset Script
<?php
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@eduardopintor
eduardopintor / add-term-to-post-tag.php
Created July 5, 2017 17:10 — forked from algmelo/add-term-to-post-tag.php
add term metabox to post_tag taxonomy - using WP 4.4 term meta functions
<?php
// source: http://wordpress.stackexchange.com/questions/211703/need-a-simple-but-complete-example-of-adding-metabox-to-taxonomy
// code authored by jgraup - http://wordpress.stackexchange.com/users/84219/jgraup
// REGISTER TERM META
add_action( 'init', '___register_term_meta_text' );
function ___register_term_meta_text() {
@eduardopintor
eduardopintor / add-several-term-meta-fields-to-custom-taxonomy.php
Created July 5, 2017 17:13 — forked from ms-studio/add-several-term-meta-fields-to-custom-taxonomy.php
A variation on the previous gists, this time we add *several* term meta fields
<?php
// source: http://wordpress.stackexchange.com/questions/211703/need-a-simple-but-complete-example-of-adding-metabox-to-taxonomy
// original code authored by jgraup - http://wordpress.stackexchange.com/users/84219/jgraup
/*
* NOTE:
* We are registering the fields for a custom taxonomy, called "user-logement".
*/
@eduardopintor
eduardopintor / functions.php
Created July 14, 2017 18:49
Filtro para alterar o link de preview de post
function elshamah_update_post_link($link) {
$link = str_replace(home_url(), site_url(), $link);
return $link;
}
add_action('admin_init', 'elshamah_admin_filters');
@eduardopintor
eduardopintor / bitbucket-webhook.php
Created November 7, 2017 16:33 — forked from maztch/bitbucket-webhook.php
A simple php script for deploy using bitbucket webhook
<?php
//edit with your data
$repo_dir = '~/repository.git';
$web_root_dir = '~/project';
$post_script = '~/project/scripts/post_deploy.sh';
$onbranch = 'master';
// A simple php script for deploy using bitbucket webhook
// Remember to use the correct user:group permisions and ssh keys for apache user!!
// Dirs used here must exists on server and have owner permisions to www-data
@eduardopintor
eduardopintor / documentation and installation
Created February 2, 2018 19:08 — forked from maliMirkec/documentation and installation
Batch scripts for image optimization
http://www.tecmint.com/optimize-and-compress-jpeg-or-png-batch-images-linux-commandline/
https://blarg.co.uk/blog/recursively-optimize-png-files
# install jpegoptim
apt-get update
apt-get install jpegoptim
# install optipng
apt-get update
apt-get install optipng
@eduardopintor
eduardopintor / gist:62a78048d866fb8241ed3b1847183113
Created February 5, 2018 22:30 — forked from corsonr/gist:6138666
WooCommerce - List products by attribute (multiple values), ex: [woo_products_by_attributes attribute="colour" values="red,black" per_page="5"]
<?php
/**
* Plugin Name: WooCommerce - List Products by Attributes
* Plugin URI: http://www.remicorson.com/list-woocommerce-products-by-attributes/
* Description: List WooCommerce products by attributes using a shortcode, ex: [woo_products_by_attributes attribute="colour" values="red,black" per_page="5"]
* Version: 1.0
* Author: Remi Corson
* Author URI: http://remicorson.com
* Requires at least: 3.5
* Tested up to: 3.5
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yoast SEO Dashboard Widget
* Credit: Unknown
* Last Tested: Jun 16 2017 using Yoast SEO 4.9 on WordPress 4.8
*/
add_action('wp_dashboard_setup', 'remove_wpseo_dashboard_overview' );
@eduardopintor
eduardopintor / admin.js
Created March 7, 2018 22:32 — forked from vralle/admin.js
Adding a Media Button to the WordPress Editor.
jQuery(function($) {
$(document).ready(function(){
$('#insert-my-media').click(open_media_window);
});
function open_media_window() {
if (this.window === undefined) {
this.window = wp.media({
title: 'Insert a media',
library: {type: 'image'},