Skip to content

Instantly share code, notes, and snippets.

<?php
define ( 'BP_ENABLE_ROOT_PROFILES', true );
define( 'BP_DEFAULT_COMPONENT', 'settings' );
//dropzone
define( 'DROPZONEJS_PLUGIN_URL', get_stylesheet_directory_uri() );
define( 'DROPZONEJS_PLUGIN_VERSION', '0.0.1' );
add_action( 'init', 'dropzonejs_init' );
function dropzonejs_init() {
@ricardobrg
ricardobrg / brg_login_redirect.php
Created May 30, 2016 11:52
Simple WordPress login redirect. Can be used as a mu-plugin or in functions.php
<?php
function brg_login_redirect( $redirect_to, $request, $user ) {
global $user;
//if there's a user with defined roles
if ( isset( $user->roles ) && is_array( $user->roles ) ) {
//check if it's admin
if ( in_array( 'administrator', $user->roles ) ) {
//admins can go anywhere
return $redirect_to;
#!/bin/bash
# Script to lauch WordPress Dev Site
NOME="$(date +%s%N | cut -b1-13)"
for i in "$@"
do
case $i in
-n=*|--nome=*)
NOME="${i#*=}"
shift #past argument=value
;;
@ricardobrg
ricardobrg / functions.php
Created May 4, 2016 01:09
Estados e cidades brasileiras populados em uma taxonomia do wordpress.
<?php
// É aconselhável criar um backup do banco antes
// crie a taxonomia cidade na functions do tema
add_action('init', 'register_locations');
function register_locations() {
register_taxonomy( 'cidade',array (
0 => 'locais',
),
array( 'hierarchical' => true,