• I’m using jQuery Supersized to create a full screen image slideshow. The images are called from a custom post type called Slides.

    The below code works fine but I want to be able to only pull in Slides in a specific category and for some reason I can’t get this to work.

    I’ve tried adding ‘&category_name=’ to the first line to this but it’s not working:

    query_posts(‘post_type=slides&category_name=project1&order=ASC&posts_per_page=-1’);

    Any ideas?

    Thanks

    query_posts(‘post_type=slides&order=ASC&posts_per_page=-1’);
    $output = “”;
    $n= 0;

    //Loop for Post Types Slides
    if ( have_posts() ) while ( have_posts() ) : the_post();
    $n++;

    //Slide Image
    $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), ‘full’);

    //Get the Slide meta info
    $slide_link = get_post_meta(get_the_ID(), ‘mb_slide_link’, true);

    $output.=”{“;
    $output.=”image : ‘”. $thumbnail[0] .”‘”;

    if($slide_link != ”){
    $output.=” , url : ‘”. $slide_link.” ‘”;
    } ;

    $output.=”},”;

  • The topic ‘Custom Post Types & category_name’ is closed to new replies.