Skip to content

Instantly share code, notes, and snippets.

(function($){
$('.menu-clientes').on('click', function () {
$('html, body').animate({
scrollTop: $("#clientes").offset().top-40
}, 2000);
});
})(jQuery);
<?php
// Versão funcionando, pelo menos para minha necessidade
// Essa função é disparada com alguns critérios em uma página usada apenas para essa migração.
function migration() {
include( 'wp-admin/includes/media.php' );
include( 'wp-admin/includes/file.php' );
include( 'wp-admin/includes/image.php' );
$query = new WP_Query( array(
'post_type' => 'post', /* O post type que vai usar*/
'posts_per_page' => -1,
@everaldomatias
everaldomatias / get_excerpt()
Last active August 29, 2015 14:20
Função WordPress para gerar resumos com limite de caracteres
/**
* Function get_excerpt
*
* @since 0.1
*
* @param string $content with text to excerpt.
* @param string $limit number of the limit.
* @param string $after with element to print in end excerpt.
*
* @return string
SET @oldsite='http://localhost.com';
SET @newsite='http://producao.com.br';
UPDATE wp_options SET option_value = replace(option_value, @oldsite, @newsite) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, @oldsite, @newsite);
UPDATE wp_links SET link_url = replace(link_url, @oldsite, @newsite);
UPDATE wp_postmeta SET meta_value = replace(meta_value, @oldsite, @newsite);
UPDATE wp_posts SET guid = replace(guid, @oldsite, @newsite);
@everaldomatias
everaldomatias / loop-terms.php
Created October 23, 2015 00:31
Loop separando os posts por terms
<?php
$args = array( 'hide_empty=0' );
$funcoes = get_terms( 'posicao', $args );
if ( ! empty( $funcoes ) && ! is_wp_error( $funcoes ) ) {
$count = count( $funcoes );
foreach ( $funcoes as $funcao ) {
$output_terms .= $funcao->term_id . ',';
}
}
// WordPress
// Use in functions.php
// Disable the admin bar except for admin users
add_action( 'after_setup_theme', 'remove_admin_bar' );
function remove_admin_bar() {
if ( ! current_user_can( 'administrator' ) && ! is_admin() ) {
show_admin_bar( false );
}
}
<div class="w80">[email* your-email placeholder "Seu melhor e-mail"]</div>
<div class="w20">[submit "Enviar"]</div>
input[type="email"], input[type="submit"] {
width: 100%;
}
.w20 {
float: left;
width: 20%;
}
.w40 {
float: left;
width: 40%;
function change_labels_post( $labels ) {
//$labels->name = 'Posts';
//$labels->singular_name = 'Post';
//$labels->add_new = 'Adicionar Novo';
//$labels->add_new_item = 'Adicionar novo post';
//$labels->edit_item = 'Editar post';
//$labels->new_item = 'Novo Post';
//$labels->view_item = 'Ver Post';
//$labels->search_items = 'Pesquisar posts';
@everaldomatias
everaldomatias / odin-gallery-metabox.php
Last active February 5, 2017 20:07
Adiciona galeria de imagens (image_plupload) ao CPT Fotos.