This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//With term IDs | |
$categories = array('1','2','3','4','5'); | |
$cats_to_add = array_map ('intval', $categorias); //ALWAYS CHECK IF IDs ARE INTEGERS!! | |
//With term names | |
//$cats_to_add = ('categoria 1', 'categoria 2', 'categoria 3', 'Categoria 4','categoria Cinco'); | |
if(wp_exist_post_by_title($string['title'])){ | |
echo 'post exists'; | |
} else { | |
$my_post = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* NOTICE | |
* This script imports SQL commands "as is". | |
* Double check the SQL commands before using it | |
* and BACKUP YOUR DATABASE. | |
* It needs some improvement to use wpdb->prepare. | |
*/ | |
class WPSQLImporter{ | |
/** | |
* Loads an SQL stream into the WordPress database one command at a time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//cria o wp_cron para checar a cotação a cada hora | |
add_action('wp','brg_agenda_cotacao'); | |
function brg_agenda_cotacao() { | |
if (! wp_next_scheduled ( 'brg_atualiza_cotacao' )) { | |
wp_schedule_event(time(), 'hourly', 'brg_atualiza_cotacao'); | |
} | |
} | |
//função para atualizar a cotação no wp_options | |
add_action('brg_atualiza_cotacao', 'brg_cotacao_dolar'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.brgweb.utilsexample; | |
import android.app.Activity; | |
import android.app.AlertDialog; | |
import android.content.ActivityNotFoundException; | |
import android.content.Context; | |
import android.content.DialogInterface; | |
import android.content.Intent; | |
import android.content.pm.PackageManager; | |
import android.net.ConnectivityManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public boolean isTelefone(String numeroTelefone) { | |
return numeroTelefone.matches(".((10)|([1-9][1-9]).)\\s[9][6-9][0-9]{3}-[0-9]{4}") || | |
numeroTelefone.matches(".((10)|([1-9][1-9]).)\\s[2-5][0-9]{3}-[0-9]{4}"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'init', 'blockusers_init' ); | |
function blockusers_init() { | |
//check if user is administrator | |
if (! current_user_can( 'administrator' ) ){ | |
//check if it's wp-admin and not ajax calls | |
if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { | |
//redirect to home | |
wp_redirect( home_url() ); | |
//exit after redirect is required |
OlderNewer