Skip to content

Instantly share code, notes, and snippets.

View RafaelFunchal's full-sized avatar

Rafael Funchal RafaelFunchal

View GitHub Profile
@RafaelFunchal
RafaelFunchal / MailPoet: Unsubscribe Inactive Users
Last active August 29, 2015 14:03
SQL to unsubscribe inactive subscribers, never opened and never clicked in MailPoet
UPDATE wp_wysija_user as A
JOIN (
SELECT user_id
FROM wp_wysija_email_user_stat
GROUP BY user_id
HAVING SUM(status) <= 0
) B ON A.user_id = B.user_id
SET A.status = -1
@RafaelFunchal
RafaelFunchal / web.config - Permalinks
Created April 12, 2014 16:18
Beautiful WordPress permalinks in Windows Servers (IIS)
@RafaelFunchal
RafaelFunchal / WordPress SASS gallery
Created March 29, 2014 21:33
Loop to formate WordPress gallery with sass
@RafaelFunchal
RafaelFunchal / .htaccess - Permalinks in localhost
Created March 18, 2014 22:54
Beautiful WordPress permalinks in localhost
@RafaelFunchal
RafaelFunchal / BuddyPress redirect after login
Last active August 29, 2015 13:56
Redirect a BuddyPress member to a specific page after login
<?php
function redirect_after_login() {
if( is_user_logged_in() && bp_is_register_page() ) {
bp_core_redirect( get_option('home') . '/page-slug/' );
}
}
add_action( 'template_redirect', 'redirect_after_login', 1 );
# Sync fork with original repository
#
# Requires an "upstream" remote, pointing to original repo
# e.g. `git remote add upstream [email protected]:user/repo.git`
alias git-sync-fork="git fetch upstream; git checkout master; git merge upstream/master"
<?php
/*
Enviar e-mail para o administrador se houver posts para revisão
Dicas do @GugaAlves (@tudoparawp):
- Adicionar link para enviar e-mail diretamente para o administrador;
- Incluir link para a edição do post no admin, facilitando a vida do admin que receber este email.
Dicas do Gustavo Bordoni (@webord):
- incluir na função o $post (objeto para WP_Query) para não ficar passando o $post_id a cada save;
// SmoothScroll for websites v1.2.1
// Licensed under the terms of the MIT license.
// People involved
// - Balazs Galambosi (maintainer)
// - Michael Herf (Pulse Algorithm)
(function(){
// Scroll Variables (tweakable)
<?php
/*
* Plugin Name: Category Image Field
* Plugin URI: http://claudiosmweb.com/
* Description: Adds image field in category description.
* Version: 0.1
* Author: Claudio Sanches
* Author URI: http://claudiosmweb.com/
* License: GPLv2 or later
*/
@RafaelFunchal
RafaelFunchal / Populando uma div com ajax
Last active December 16, 2015 10:18
Populando uma div com ajax usando o WordPress
<!--
Essa parte do código deve ser inserida no arquivo onde está o formulário.
-->
<script>
// Isso evitará que a página seja recarrega ao enviar o formulário
$('form').submit(function () {
return false;
});
// Quando o submit do formulário for clicado
$("#id-do-seu-botao").click( function() {