Help, Code Plugin Posts Random show
-
Hello people, you can have if I made a hand.
I own this Plugin InKiLiNo for WodPress, which displays a number of blog posts at random.
The issue is that only shows the title of each post and also need to show the contents, more specifically the content of <?php the_excerpt(”); ?>
or in this case the custom field to be joined in every inning, in my case seriously, the key = Thumbs. because it would show images.
The Plugin code is as follows.
<?php /* Plugin Name: PostsAleatorios Version: 2.0 Plugin URI: http://www.inkilino.com/2007/02/01/plugin-posts-aleatorios/ Description: Genera una lista de posts antiguos aleatoriamente, para que no se pierdan en el recuerdo. Author: InKiLiNo Author URI: http://www.inkilino.com/ Para su uso: <h4>Entradas Aleatorias</h4> <ul> <?php postsaleatorios(); ?> </ul> */ function unpostaleatorio() { global $wpdb, $tableposts; $query = "SELECT count(ID) as c FROM $tableposts WHERE post_status = 'publish'"; $cnt = $wpdb->get_results($query); $cnt = rand(0, $cnt[0]->c); $query = "SELECT ID FROM $tableposts WHERE post_status = 'publish' LIMIT $cnt, 1"; $post = $wpdb->get_results($query); //$link = get_permalink($post[0]->ID); $my_id=$post[0]->ID; $link = get_permalink($my_id); $post_id = get_post($my_id); $title = $post_id->post_title; ?> <div class="item" onmouseover="this.className='item2'" onmouseout="this.className='item'"> <h2><a href="<?php echo $link; ?>" title="<?php echo $title; ?>"><?php echo $title; ?></a></h2> <p><a href="<?php $values = get_post_custom_values("url"); echo $values[0]; ?>" title="<?php the_title(); ?>"> <img src="<?php $values = get_post_custom_values("thumbs"); echo $values[0]; ?>" alt="<?php the_title(); ?>" /></a></p> </div> <?php } function postsaleatorios() { $x = 1; $cantidaddeposts = 10; //Aqui podeis cambiar la cantidad de posts que aparecen, cambiar el 10 por el numero que querais while ($x <= $cantidaddeposts) { echo unpostaleatorio(); $x = $x + 1; } } ?>
To have someone who understands the theme of “all soys that unless I xD” facts can a cable.
Greetings. xD
Thanks in advance and
- The topic ‘Help, Code Plugin Posts Random show’ is closed to new replies.