• Resolved spk

    (@spk)


    hi, i’m trying to manipulate the following index.php code to retrieve and display a fixed number of posts from a certain category. i know the function to do that would be something like e.g.

    query_posts("category_name=featured&orderby=rand&showposts=6");

    however, i’m having difficulties figuring out how to integrate this into the existing code… will appreciate some advise. thanks

    https://wordpress.pastebin.com/kqMWVrSq

Viewing 2 replies - 1 through 2 (of 2 total)
  • Alwyn Botha

    (@123milliseconds)

    Just before line 37 add

    <?php query_posts($query_string . ‘&category_name=featured&orderby=rand&showposts=6’); ?>

    Thread Starter spk

    (@spk)

    thanks very much for your reply. alternatively, what i did was to put this code right after <?php get_header();?> :

    <?php global $wp_query;
    query_posts(
    	array_merge(
    		array('category_name' => 'featured', 'orderby' => 'rand', 'showposts' => '8'),
    		$wp_query->query
    	)
    );?>

    worth mentioning: it’s the Tanzaku theme we’re dealing with here.

    thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘filter category in index loop’ is closed to new replies.