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
@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 / conditional-metabox-to-page-template.php
Created December 19, 2016 22:33
Conditional Metabox to Page Template
<?php
if ( is_admin() && !empty( $_POST['post_ID'] ) ) {
$post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ;
$template_file = get_post_meta( $post_id,'_wp_page_template',TRUE );
if ( $template_file == 'page_custom_template.php' ) {
add_action( 'init', 'custom_metabox', 1 );
}
}
@everaldomatias
everaldomatias / odin-gallery-metabox.php
Last active February 5, 2017 20:07
Adiciona galeria de imagens (image_plupload) ao CPT Fotos.