WordPress. Mostrare articoli con data futura
WordPress permette di salvare gli articoli e di programmarne la pubblicazione non subito, ma in una data futura (dopo un’ora, dopo un giorno, dopo due giorni, una settimana etc…).
E possibile quindi sfruttare questa funzionalità per mostrare nel nostro blog una lista degli articoli che verranno pubblicati prossimamente.
Con poche righe di codice è possibile ottenere questo risultato:
[PHP]
< ?php
$pq = 'post_status=future&order=DESC&showposts=5';
$prox = new WP_Query($pq);
if ($prox->have_posts()) { ?>
-
< ?php
while ($prox->have_posts()) : $prox->the_post();
- < ?php the_title(); ?> (< ?php the_time('j F Y'); ?>)
$unico = $post->ID;
?>
< ?php endwhile; ?>
< ?php } ?>
[/PHP]
Il post originale è questo.
Tags: loop tips WordPress
Pubblicato lunedì 17 Novembre 2008 in Hack WordPress. Ultimo aggiornamento: lunedì 29 Novembre 2010.
Letture: 9317.
Link correlati
40 Free and Premium Creative WordPress Themes
Whether you are an artist, graphic designer, photographer or a magazine or newspaper owner, you would require some real catchy and awesome creative WordPress themes to display your work.
Add From Server
“Add From Server” is a quick plugin which allows you to import media & files into the WordPress uploads manager from the Webservers file
CSS3 Animated Media Queries
In this article we are going to look at media queries, have a code snippet you can use to start your media queries and show how you can combine CSS transition with the media queries to show an animated change to your elements.
FeatPlug
Featplug is a standalone script / wordpress plugin that can mine your WordPress posts or any other data and look for images suiting a given dimension and generates ‘featured’ section for your site using the found items.
Five Tools to Increase the RSS Subscribers for your WordPress Blog
5 plugin per WordPress per aumentare gli iscritti al feed RSS.
How to display your latest Google+ update on your WordPress blog
How you can easily display your latest Google+ update on your WordPress blog.
JavaScript to Footer
WordPress default behavior is to load JavaScript in the <head> page.
This plugin will move all javascript code to the footer if the plugins have declared JavaScript properly.
MTR Podcast Recorder
MTR Podcast Recorder offers real-time recording (via a Java applet) that is saved into MP3 format on the same server where WordPress is installed.
Page Links To
This plugin allows you to make a WordPress page or post link to a URL of your choosing, instead of its WordPress page or post URL. It also will redirect people who go to the old (or “normal”) URL to the new one you’ve chosen.
Search Everything
Plugin che permette di estendere la ricerca di default di WordPress anche alle Pagine, alle Categorie e ai Tag, ai Commenti (con possibilità di escludere o includere quelli approvati), alle Bozze, gli estratti e gli allegati e ai Campi personalizzati. E’ possibile inoltre, escludere dalla ricerca gli Articoli e le Categorie, a scelta.
Speed up your blog by caching custom queries
An useful snippet to cache custom queries in WordPress. Don’t forget to update the query on line 5!
Top WordPress Responsive Themes
As WordPress is the most popular and secure platform today, it is obvious that there is plethora of great responsive WordPress themes out there. Here are some of the best available.
WP Equal Columns
Plugin per WordPress che rende uguale l’altezza delle colonne del tema usato, ad esempio la barra laterale e la colonna principale.
WP FancyZoom WordPress Plugin
A simple way to add the FancyZoom image overlay script to your blog. In short, FancyZoom is a nice, modern way of making popup images.