Skip to content

Instantly share code, notes, and snippets.

View mauriciogofas's full-sized avatar

Mauricio Gofas mauriciogofas

View GitHub Profile
<?php
/**
* Gravity Wiz // Gravity Forms // Map Submitted Field Values to Another Field
*
* Preview your Gravity forms on the frontend of your website. Adds a "Live Preview" link to the Gravity Forms toolbar.
*
* Usage
*
* 1 - Enable "Allow field to be populated dynamically" option on field which should be populated.
* 2 - In the "Parameter Name" input, enter the merge tag (or merge tags) of the field whose value whould be populated into this field.
Verifying that +gofas is my openname (Bitcoin username). https://onename.com/gofas
@mauriciogofas
mauriciogofas / my_init_email_as_username.php
Last active August 29, 2015 14:16 — forked from strangerstudios/my_init_email_as_username.php
Use the email address as username with PMPro checkout. You'll also have to hide the username fields at checkout using CSS or a custom checkout page template.
<?php
function my_init_email_as_username()
{
//check for level as well to make sure we're on checkout page
if(empty($_REQUEST['level']))
return;
if(!empty($_REQUEST['bemail']))
$_REQUEST['username'] = $_REQUEST['bemail'];
@mauriciogofas
mauriciogofas / add-capability.php
Last active August 29, 2015 14:16 — forked from jgalea/add-capability.php
Adds a capability to an existing role
<?php
function add_capability() {
// gets the author role
$role = get_role( 'author' );
// This only works, because it accesses the class instance.
$role->add_cap( 'edit_others_posts' );
}
add_action( 'admin_init', 'add_capability');
@mauriciogofas
mauriciogofas / functions.php
Created February 22, 2015 04:54
Logo personalizado em wp-login.php
// Logo Padrão no Login
function gofas_wp_login_image() {
echo "
<style>
body.login #login h1 a {
background: url('".get_bloginfo('url')."/uploads/logo.png') 0px 0 no-repeat transparent;
height:50px;
width:160px; }
</style>
@mauriciogofas
mauriciogofas / rrwd_upload_dir.php
Last active August 29, 2015 14:15 — forked from rianrietveld/rrwd_upload_dir.php
Add custom post type name to upload directory WordPress
<?php
/**
* Change Upload Directory for one Custom Post-Type
* Author: https://gist.github.com/RRWD/8705908
* This will change the upload directory for a custom post-type. Attachments for this custom post type will
* now be uploaded to a seperate "uploads" directory. Make
* sure you swap out "post-type" and the "my-dir" with the appropriate values...
* credits to: http://wordpress.stackexchange.com/users/4044/jhdenham
* and http://yoast.com/smarter-upload-handling-wp-plugins/
*/
@mauriciogofas
mauriciogofas / test.php
Last active August 29, 2015 14:15 — forked from raewrites/test.php
Display Post and Page IDs in the WordPress Admin
// fonte: http://premium.wpmudev.org/blog/display-wordpress-post-page-ids/
add_filter( 'manage_posts_columns', 'revealid_add_id_column', 5 );
add_action( 'manage_posts_custom_column', 'revealid_id_column_content', 5, 2 );
function revealid_add_id_column( $columns ) {
$columns['revealid_id'] = 'ID';
return $columns;
}
@mauriciogofas
mauriciogofas / functions.php
Last active August 29, 2015 14:15
add tag support to pages - wp
/*
Plugin Name: Post Tags and Categories for Pages
Plugin URI: http://wpthemetutorial.com/plugins/post-tags-and-categories-for-pages/
Description: Simply adds the stock Categories and Post Tags to your Pages.
Version: 1.3
Author: curtismchale
Author URI: http://wpthemetutotial.com/about/
License: GNU General Public License v2.0
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
@mauriciogofas
mauriciogofas / ssl_only_in_especific_site.php
Last active August 29, 2015 14:15
pt_BR: Permite que apenas o site principal da rede e outros sites específicos sejam acessados com https://, sem interferir nos demais sites da rede que não possuem certificado de segurançaapenas, ou seja, que podem ser acessados apenas com http://. en_US: Allows only the main network site and other specific sites are accessed with https://, with…
<?php
/*
Plugin Name: SSL URLs Only in Specific Sites of Network
Plugin URI: https://www.gofas.com.br/
Description: pt_BR: Permite que apenas o site principal da rede e outros sites específicos sejam acessados com https://, sem interferir nos demais sites da rede que não possuem certificado de segurançaapenas, ou seja, que podem ser acessados apenas com http://.
en_US: Allows only the main network site and other specific sites are accessed with https://, without interfering with other network sites that do not have SSL certificate in other words, that can be accessed only with http:// and not with https://.
Version: 0.4
Author: Mauricio Gofas
Author URI: https://www.gofas.com.br
Network: True
@mauriciogofas
mauriciogofas / functions.php
Last active August 29, 2015 14:15
Muda a pasta de uploads padrão do WordPress && Change the default upload folder via the WordPress
<?php
/*
* Muda a pasta de uploads padrão do WordPress via functions.php
* mesmo com "define( 'UPLOADS', 'wp-content/'.'uploads' );" em wp-config.php
* Ideal para wp multisite.
* Change the default upload folder via the WordPress functions.php
* Even with "define( 'UPLOADS', 'wp-content/'.'uploads' );" in wp-config.php
* Ideal for wp multisite
* @upload_dir