Skip to content

Instantly share code, notes, and snippets.

View chrdesigner's full-sized avatar

César Ribeiro chrdesigner

View GitHub Profile
@chrdesigner
chrdesigner / show_future_post.php
Last active December 29, 2015 10:29
Display posts with 'future' status
<?php
add_filter('the_posts', 'show_future_posts');
function show_future_posts($posts)
{
global $wp_query, $wpdb;
if(is_single() && $wp_query->post_count == 0)
{
$posts = $wpdb->get_results($wp_query->request);
@claudiosanches
claudiosanches / functions.php
Last active March 8, 2017 16:26
WordPress - Last posts with ajax.
<?php
function cs_last_posts_json() {
$json = array();
$last_posts = get_posts( array(
'posts_per_page' => 5,
'post_type' => 'post'
) );
foreach ( $last_posts as $post ) {