Skip to main content
CSS-Tricks
  • Articles
  • Videos
  • Almanac
  • Newsletter
  • Guides
  • DigitalOcean
  • DO Community
Search

Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home › Forums › Back End › WordPress Archive pages are displaying all posts.

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • September 25, 2010 at 3:09 pm #30358
    JasonMediaDecay
    Member

    I’ve been working on my own theme making heavy use of custom post types and custom taxonomies and there just isn’t a lot of info surrounding their use after creation. For example this is the problem I’ve run into right now. Currently my archive pages will display all posts. So I can click on a term in any taxonomy and I get back every post on my site, even if it doesn’t use that taxonomy. This is the code for my taxonomy.php



    query_posts(
    array('post_type' => array
    ('post', 'movie_review', 'tv_review', 'book_review', 'album_review', 'attachment'), 'paged'=>$paged)); ?>


    printf( __( 'Posts classified under: %s' ), '' . $term_name . '' );
    ?>


    $term_descr

    n"; } ?>







    " rel="bookmark" title="Permanent Link to ">Movie Review:





















    Not Found


    Sorry, but the requested resource was not found on this site.










    Now I had previously thought I had this solved when making my category archives but apparently I didn’t. But at least something is going right there (I think because I’m only calling the custom post type that would fit in that category). To explain I have 2 things in the “Film” category one is a regular post and the other is of the cpt “movie_review”. Now if I click on the “Film” category I get back those 2 posts plus the “Hello World!” post which is under “Uncategorized”. The only reason it’s not returning every single post in this case I believe is that I’m only calling the movie_review post type. This is the code I’m using on my category-film.php:


    query_posts(
    array('post_type' => array
    ('post', 'movie_review', 'attachment'), 'paged'=>$paged)); ?>


    printf( __( 'Category Archives: %s' ), '' . single_cat_title( 'Film', true ) . '' );
    ?>






    if ( 'movie_review' == $post_type ) { ?>



    " rel="bookmark" title="Permanent Link to ">










    " rel="bookmark" title="Permanent Link to ">

















    Sorry, no posts matched your criteria.











    What am I doing wrong? I cannot find a solution to this anywhere. If you need to see any other source the site is at http://www.jasonfoulke.com/md2/. It’s just a test setup with test/dummy content right now.

    September 27, 2010 at 4:23 pm #78953
    JasonMediaDecay
    Member

    Anyone have any idea? I’m still totally stuck on this.

    September 28, 2010 at 12:54 am #78969
    willB
    Member

    What Happens when you do this?


    query_posts(
    array('post_type' => get_query_var( 'taxonomy' ), 'paged'=>$paged)); ?>
    September 28, 2010 at 11:03 am #78977
    JasonMediaDecay
    Member

    I get the “no posts” message.

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Back End’ is closed to new topics and replies.

CSS-Tricks is powered by DigitalOcean.

Keep up to date on web dev

with our hand-crafted newsletter

DigitalOcean
  • DigitalOcean
  • DigitalOcean Community
  • About DigitalOcean
  • Legal
  • Free Credit Offer
CSS-Tricks
  • Email
  • Guest Writing
  • Book
  • Advertising
Follow
  • Mastodon
  • Twitter
  • Instagram
  • YouTube
  • CodePen
  • iTunes
  • RSS
Back to Top