Skip to content

Instantly share code, notes, and snippets.

View luisfelipe-dev's full-sized avatar
:octocat:
👨🏻‍💻

Luís Felipe de Olivera luisfelipe-dev

:octocat:
👨🏻‍💻
View GitHub Profile
@luisfelipe-dev
luisfelipe-dev / Data WP
Created November 29, 2016 17:11
Mostra a data do POST
<?php the_time('d/m/Y') ?>
@luisfelipe-dev
luisfelipe-dev / Mostrar Post Categoria
Created November 30, 2016 11:07
Mostra Posts de uma determinada categoria.
<?php
$wp_query = new WP_Query();
query_posts( array( 'category_name' => 'lifestyle', 'showposts' => 2,));
if(have_posts()):
while ($wp_query -> have_posts()) : $wp_query -> the_post();
?>
<div class="item-mega-menu">
<li>
<div class="item-img-destaque">
<img src="<?php the_field('imagem_destaque'); ?>">
@luisfelipe-dev
luisfelipe-dev / Head Padrão
Last active April 12, 2018 14:07
O meu padrão head que sigo em meus sites.
<!DOCTYPE html>
<html lang="pt_BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Titulo</title>
<meta name="robots" content="index, follow"/>
<!-- Favicon -->
<link rel="icon" href="dist/img/favicon-16.png" sizes="16x16" type="image/png">
@luisfelipe-dev
luisfelipe-dev / Efeito Hover - Aparecer nome do logo
Created February 9, 2017 13:57
Efeito ao passar o mouse aparecer alguma informação
@luisfelipe-dev
luisfelipe-dev / Post's por Nome
Created February 16, 2017 17:08
Puxa os post's por ordem alfabética.
<?php
$args = array (
'post_type' => 'eventos', // ou post_type => 'post'
'orderby'=> 'title',
'order' => 'ASC',
'posts_per_page' => '50'
);
$the_query = new WP_Query ( $args );
?>
@luisfelipe-dev
luisfelipe-dev / Padrão CSS BLOG
Last active March 14, 2017 20:07
Um padrão para se usar ao criar classes em blog's.
img, object, embed, video {
max-width: 100%;
height: auto;
}
iframe{
margin:auto;
display:block;
max-width: 100%;
}
@luisfelipe-dev
luisfelipe-dev / ACF IF - Dentro de um repetidor
Created March 15, 2017 11:50
Só aparece a opção se for cadastrada.
<?php if( get_sub_field('telefone_representante') ): ?>
<p><i class="fa fa-phone" aria-hidden="true"></i> <?php echo the_sub_field('telefone_representante');?></p>
<?php endif; ?>
<?php
$images = get_field('galeria1');
if( $images ): ?>
<div id="sync1" class="owl-carousel">
<?php foreach( $images as $image ): ?>
<div class="item"><h1><img src="<?php echo $image['sizes']['large']; ?>" alt="<?php echo $image['alt']; ?>" /></h1></div>
@luisfelipe-dev
luisfelipe-dev / Imagem destaque WP como BG
Created March 28, 2017 14:47
Colocar a imagem de destaque do Wordpress como background.
<?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post' ); ?>
<div class="foto_blog-novo" style='background: url("<?php echo $image[0]; ?>") no-repeat center; background-size: cover;' >
</div><!-- /foto_blog-novo -->
@luisfelipe-dev
luisfelipe-dev / Efeito Scroll
Last active November 2, 2017 13:29
Efeito Scroll muito fácil de fazer!
$('.heading a').click(function(e){ //COLOCAR A CLASSE DO MENU NO LUGAR DO '.heading'
e.preventDefault();
var id = $(this).attr('href'),
targetOffset = $(id).offset().top,
menuHeight = $('.heading').innerHeight(); //COLOCAR A CLASSE DO MENU NO LUGAR DO '.heading'
$('html,body').animate({
scrollTop: targetOffset - menuHeight
},500); //500 = VELOCIDADE DO SCROLL
});