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
// Coloque o código abaixo no arquivo functions.php do seu tema. O número 80 é a quantidade de caracteres a exibir. | |
function get_excerpt(){ | |
$excerpt = get_the_content(); | |
$excerpt = preg_replace(" (\[.*?\])",'',$excerpt); | |
$excerpt = strip_shortcodes($excerpt); | |
$excerpt = strip_tags($excerpt); | |
$excerpt = substr($excerpt, 0, 80); | |
$excerpt = substr($excerpt, 0, strripos($excerpt, " ")); | |
$excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt)); | |
return $excerpt; |
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 | |
// Caso o usuário esteja logado | |
if ( is_user_logged_in() ) : | |
?> | |
Aqui você coloca o seu conteúdo, normalmente é a função do WordPress | |
<?php the_content(); ?> | |
<?php | |
// Caso o usuário não esteja logado | |
else : | |
?> |
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 | |
// Documentação completa em http://codex.wordpress.org/Class_Reference/WP_Query | |
$args = array( | |
'cat' => 1, //ID da sua categoria | |
'posts_per_page ' => 4, // Número de posts a exibir | |
); | |
$novo_loop = new WP_Query( $args ); | |
if ( $novo_loop->have_posts() ) : while ( $novo_loop->have_posts() ) : $novo_loop->the_post(); |
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 | |
$attachment_args = array( | |
'post_type' => 'attachment', | |
'numberposts' => -1, | |
'post_status' => 'any', | |
'post_parent' => get_the_ID() | |
); | |
$attachments = get_posts( $attachment_args ); |
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
<!-- | |
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() { |
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 | |
/* | |
* 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 | |
*/ |
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
// 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) |
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 | |
/* | |
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; |
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
# 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" |
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 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 ); |
OlderNewer