Si quieres poner un post aleatorio en alguna sección de tu blog, por ejemplo el sidebar, puedes implementarlo de la siguiente manera.
Primero crea un archivo random.php con el siguiente código.
get_row("select id from $wpdb->posts where post_status='publish' order by rand() limit 1″);
$random = get_permalink($post->ID)
status_header(301);wp_redirect( $random );
exit();
?>
Súbelo al directorio en donde tienes la instalación de WordPress y listo, solamente tienes que hacer un llamado al archivo random.php en donde quieres que aparezca tu post aleatorio.
Si no se te da mucho lo del código, puedes instalar este plugin.
VÃa | 86400.
Como crear un post aleatorio en WordPress
No Comments
Be the first to start the conversation.