• How do I replace pulling a post with a certain category to pulling a custom post type with a certain category. I want to leave the ability to determine the number of posts shown by using the theme’s widget.

    This is the code I think I need to fiddle with.

    $query = new WP_Query( array( 'cat' =>$slidecat,'posts_per_page' =>$count ) );
    		           	if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();	?>
Viewing 1 replies (of 1 total)
  • You will want to use ‘post_type’ in the argument, so using the code above and with a custom post type called ‘music’ for example, you would do something like:

    $query = new WP_Query( array( ‘post_type’ => ‘music’, ‘cat’ =>$slidecat,’posts_per_page’ =>$count ) );
    if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); ?>

    For more info see the args for WP_Query: http://codex.wordpress.org/Class_Reference/WP_Query

Viewing 1 replies (of 1 total)
  • The topic ‘Dynamically Pull Custom Post’ is closed to new replies.