WordPress.org

Ready to get started?Download WordPress

Forums

Category.php And Custom Post Types (4 posts)

  1. nickkos
    Member
    Posted 1 year ago #

    Okay so let me explain what Im trying to do, I am trying to make it so that my custom post type "Employees" which has categories enabled uses a dynamic category page that only lists posts within the current category that you are on.

    its like a wp_query for custom post type & catid but catid = current category that your on.

    I cannot for the life of me understand how the category query works. I've looked in countless normal themes and all that I find is a loop.

  2. gerald@WPcustoms
    Member
    Posted 1 year ago #

    I think the answer to your question is here:
    http://stackoverflow.com/questions/11955078/custom-category-php-for-wordpress-custom-post-types

    >> archive-custom_post_type.php

  3. nickkos
    Member
    Posted 1 year ago #

    I am struggling with this still its not working for me.

  4. nickkos
    Member
    Posted 1 year ago #

    <?php
    global $thisCat;
    $thisCat = get_category(get_query_var(‘cat’),false);
    query_posts(&post_type=Employees&post_status=publish&posts_per_page=10&cat=.$thisCat->cat_ID);
    // The Loop
    while ( have_posts() ) : the_post();
     ?>
    	<div id="employee">
    			<div class="pframe"><?php if ( has_post_thumbnail() ) {
    	the_post_thumbnail( array(100,100) );
    } ?></div>
    			<div class="ename"><?php the_title(); ?></div>
    			<div class="eposition">Manager</div>
    			<div class="ecompany">Section A</div>
    			<div class="email">johnsmith@interplast.com</div>
    			<div class="ext">EXT# 1234</div>
    		</div>
    <?php endwhile;
    // Reset Query
    wp_reset_query(); ?>

    I tried this no avail

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.