Finishing this guide you'll get:
- A running WordPress installation
- Nginx proxy with PHP and Fast CGI
- MySQL server accessible with phpMyAdmin
Specification of latest running installation:
- Date: 03.03.2014
Finishing this guide you'll get:
Specification of latest running installation:
<?php | |
//Rota de Paginaçnao | |
/** | |
* Rotina recebe o parametro $pagina para poder realizar a paginação | |
**/ | |
$application->get('/minharota/:pagina', function ($pagina) use ($twig_engine) { | |
$registros_por_pagina=20; | |
$meusdados = Capsule::table('minhatabela')->skip($registros_por_pagina*$pagina)->take($registros_por_pagina)->get(); | |
/** | |
* Retorno Ajax para as cidades no formulário de cadastro | |
*/ | |
$app->get('/cadastro/cidades/', function() use($app, $ajustes, $capsule){ | |
//tipo de requisição | |
$req = $app->request(); | |
$req->getContentType('application/xml;charset=utf-8'); | |
// Pega o id do estado pela url | |
$estado = $app->request()->params('pesquisa'); |
$(function(){ | |
$('#estados').change(function(){ | |
if( $(this).val() ) { | |
$('#cidades').hide(); | |
$('.carregando').show(); | |
$.getJSON('{{site_url}}/cadastro/cidades?pesquisa=',{cod_estados: $(this).val(), ajax: 'true'}, function(j){ | |
var options = '<option value=""></option>'; | |
for (var i = 0; i < j.length; i++) { | |
options += '<option value="' + j[i].cod_cidades + '">' + j[i].nome + '</option>'; | |
} |
server { | |
##DM - uncomment following line for domain mapping | |
#listen 80 default_server; | |
server_name example.com *.example.com ; | |
##DM - uncomment following line for domain mapping | |
#server_name_in_redirect off; | |
access_log /var/log/nginx/example.com.access.log; | |
error_log /var/log/nginx/example.com.error.log; |
<?php | |
//http://codeforgeek.com/2014/10/time-ago-implementation-php/ | |
function get_timeago( $ptime ) | |
{ | |
$estimate_time = time() - $ptime; | |
if( $estimate_time < 1 ) | |
{ | |
return 'less than 1 second ago'; | |
} |
<?php | |
//Faça o require do arquivo vendor.php do composer | |
//Depois de instanciado o arquivo vendor do composer, vamos instanciar o Slim | |
$app = new Slim\Slim(array( | |
'debug' => true, | |
//'view' => new Slim\Views\Twig(), //Aqui você trabalha com views personalizadas, no caso o twig. | |
'mode' => 'development', | |
)); |
server { | |
listen 80; | |
server_name CHANGEME.app; | |
root /var/www/vhosts/CHANGEME.app/public; | |
index index.html index.htm index.php; | |
charset utf-8; | |
location / { |
<?php | |
add_filter( 'jetpack_get_available_modules', 'prefix_hide_jetpack_modules' ); | |
/** | |
* Disable all non-whitelisted jetpack modules. | |
* | |
* As it's written, this will allow all of the currently available Jetpack | |
* modules to work display and be activated normally. | |
* | |
* If there's a module you'd like to disable, simply comment it out or remove it | |
* from the whitelist and it will no longer be available for activation. |
<?php | |
//Muda a prioridade da metabox do YOAST SEO | |
function yoast_to_bottom() { | |
return 'low'; | |
} | |
add_filter( 'wpseo_metabox_prio', 'yoast_to_bottom'); |