This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
YEAR( post_date ) AS year, | |
MONTH( post_date ) AS month, | |
WEEK( post_date ) as week, | |
post_type | |
COUNT(ID) as posts | |
FROM | |
wpudd_posts | |
WHERE | |
post_status = 'publish' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
YEAR( post_date ) AS year, | |
MONTH( post_date ) AS month, | |
COUNT( ID ) as posts | |
FROM | |
wpudd_posts | |
WHERE | |
post_status = 'publish' | |
GROUP BY | |
year, month |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"post": { | |
"properties": { | |
"author": { | |
"properties": { | |
"email": { | |
"type": "string", | |
"include_in_all": false | |
}, | |
"fn": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"query": { | |
"custom_filters_score": { | |
"query": { | |
"bool": { | |
"must": { | |
"query_string": { | |
"query": "ciencias políticas", | |
"fields": [ | |
"entry_title^10", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Mapeo de blog_id a dominios en producción | |
# DEBE estar fuera del bloque server | |
map $blog_id $remote_host { | |
2 www.foo.com; | |
3 www.bar.net; | |
4 www.lorem.org; | |
5 www.ipsum.ble; | |
# ... and so on and so on | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
server_name misitio.local; | |
root /var/www/misitio.com/htdocs; | |
# Debes configurar un DNS externo | |
# En este caso, estoy utilizando uno de los Google | |
resolver 8.8.8.8; | |
location ~* ^/wp-content/uploads/(.*)$ { | |
# comprueba si el archivo existe, de modo que los uploads locales sigan funcionando correctamente |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// cuántos bytes deseas generar? | |
$bytes = 32; | |
// obtener bytes semi-aleatorios | |
$rand = openssl_random_pseudo_bytes( $bytes ); | |
// $rand = "óx3OM·¸Z ÅÀKŸÅ7 #õ˜cb4G8Â,7OPc"; | |
// esta cadena puede tener caracteres de control o no representables |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($){ | |
var postTemplate = function( post ){ | |
return '<article class="hentry"><a href="#post-'+ post.ID +'">'+ post.post_title +'</a></article>'; | |
} | |
$('#load-next-posts').on('click', function(){ | |
// la variable ajaxurl debe estar definida y apuntar a wp-admin/admin-ajax.php | |
// en la data enviada con la petición, el parámetro "action" debe coincidir con la detección de la acción en PHP | |
$.get( ajaxurl, { | |
action: 'get_next_posts', | |
offset: $('.hfeed').find('.hentry').length |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// para peticiones de usuarios que no están logueados | |
add_action('wp_ajax_nopriv_get_next_posts', 'ajax_get_next_posts'); | |
// probablemente también vas a querer que los usuarios logueados puedan hacer lo mismo | |
add_action('wp_ajax_get_next_posts', 'ajax_get_next_posts'); | |
function ajax_get_next_posts(){ | |
// usamos absint() para sanitizar el valor y recibir un int |