• mserafim

    (@mserafim)


    i have this code:

    $rand_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY RAND() LIMIT 1");
          query_posts("p=$rand_id");
    	while (have_posts()) : the_post();
    	the_title();
    
    endwhile;

    The code retrive random article titles from the entire blog.
    What i want is to retrive content from only one category, for ex category ID 5.

    Thank you.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘get content from category 5 with wpdb’ is closed to new replies.