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
<script>
$(document).ready(function() {
var url = window.location;
var element = $('ul.sidebar-menu a').filter(function() {
return this.href == url || url.href.indexOf(this.href) == 0; }).parent().addClass('active');
if (element.is('li')) {
element.addClass('active').parent().parent('li').addClass('active')
}
});
</script>
<div class="pagina-interna-imprensa__materias">
<?php
$related = get_posts( array( 'category__in' => wp_get_post_categories($post->ID), 'numberposts' => 2,'post_type' => 'imprensa', 'post__not_in' => array($post->ID) ) );
if( $related ) foreach( $related as $post ) {
setup_postdata($post);
?>
<h2>Matérias Relacionadas</h2>
@luisfelipe-dev
luisfelipe-dev / Listar Categorias - Custom Post Type
Created October 4, 2018 16:22
Lista categorias custom post type - wordpress
<?php
$args = array (
'child_of' => 12
);
$categories = get_categories($args);
foreach($categories as $category) {
echo '<li id="'. $category->slug .'"><a href="' . get_category_link( $category->term_id ) . '">' . $category->name . '</a></li>';
}
?>
// HTML
<div class="loader">
<svg class="spinner" width="65px" height="65px" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
<circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle>
</svg>
</div><!-- /loader -->
// CSS
.loader {
position: fixed;
// AO CLICAR ADICIONAR A CLASSE REFERENTE AO ID
$(document).ready(function() {
$(".pagina-interna__conteudo-desk--esq ul li").on("click", function() {
// alert("clicked");
$(this)
.siblings()
.removeClass("active");
$(this).addClass("active");
});
});
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>TESTE</title>
<style>
/* BREAKPOINT 768px */
@media (min-width: 48em) {
.container {
max-width: 720px;
}
.destaque {
width: calc(60% - 5px);
margin-right: 5px;
}
.newsletter {
background: #7159c1;
color: #fff;
padding-top: 1rem;
margin-left: 15px;
margin-right: 15px;
border-radius: 5px;
margin-bottom: 1rem;
overflow: hidden;
<!-- INICIO NEWSLETTER -->
<section>
<div class='newsletter'>
<div class='container'>
<div class="d-flex">
<div class="newsletter_yoda">
<img src="img/yoda.png" alt="Yoda">
</div><!-- /newsletter_yoda -->
/* BREAKPOINT 576px */
@media (min-width: 36em) {
.container {
max-width: 540px;
}
.destaque li figcaption h3 {
color: #fff;
font-size: 2em;
}