Skip to content

Instantly share code, notes, and snippets.

View thiagotmendes's full-sized avatar

Thiago Mendes thiagotmendes

View GitHub Profile
# WordPress single blog rules.
# Designed to be included in any server {} block.
# This order might seem weird - this is attempted to match last if rules below fail.
# http://wiki.nginx.org/HttpCoreModule
location / {
try_files $uri $uri/ /index.php?$args;
}
# Add trailing slash to */wp-admin requests.
<?php
function pagination($pages = '', $range = 4)
{
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == '')
{
// box orcamento
.box-orcamento
background-color: #1D2853
width: 200px
position: fixed
right: 0
bottom: 10%
border-radius: 10px 0px 0px 10px
@media ($break-xs)
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
<?php
$cidade = "belo horizonte";
echo $_SERVER['HTTP_CLIENT_IP'];
$ip = $_SERVER['HTTP_CLIENT_IP']; // your ip address here
$query = @unserialize(file_get_contents('http://ip-api.com/php/'.$ip));
if($query && $query['status'] == 'success')
{
if($cidade == strtolower($query['city'])){
echo "aqui é BH <br>";
}
.fullscreen-bg
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
z-index: -100;
<?php
$menuLaranja = "#FF5c00";
if (is_page('servicos')) { ?>
<style>
.menu_scrool{
/* classe que o header pega quando da o scrool */
background-color: <?= $menuLaranja ?>
}
</style>
<?php
<!-- carrega os posts -->
<div id="load-questions" class="row load-questions"></div>
<p class="text-center section-btn">
<!-- Realiza o clique sempre adicionando 1 -->
<a href="" class="btn btn-site btn-load-questions" data-pagination="1">
<i class="icon icon-plus"></i> Perguntas
</a>
</p>
// inicia a variavel em 1 pois é a primeira carga
var resultPagination = 1;
// executa o load de acordo com o click no botao
$(document).on('click', '.btn-load-questions',function(){
var pagination = $(this).data('pagination'); // recebe o valor do data-pagination no html
// recebe o data-pagination e acrescenta o valor inicial + ele mesmo
resultPagination = resultPagination + 1;
// cria um efeito de load com gif
carregaGifLoad(true);
<?php
// executa o load de questões na home do site
add_action('wp_ajax_load', 'load');
add_action('wp_ajax_nopriv_load', 'load' ); // aparentemente não é obrigatorio utilizar este action
// funcao propriamente dita
function load(){
$paged = $_GET['paged'];