Support » Fixing WordPress » Portfolio template get category

  • Hi all,

    Im trying to make a portfolio template that displays only one category of the portfolio.
    Currently my portfolio displays all categories and I want it to be one specific category. Any thoughts about how to do that?

    the code I currently have is:

    function filterable_portfolio_do_loop() { ?>
    
        <header id="page-heading" class="entry-header">
            <?php $terms = get_terms( 'portfolio_category' ); ?>
        </header><!-- /page-heading -->
    
        <div class="entry-content" itemprop="text">
             <?php $wpex_port_query = new WP_Query(
                array(
                    'post_type' => 'portfolio',
                    'showposts' => '-1',
                    'no_found_rows' => true,
                )
            );
            if( $wpex_port_query->posts ) { ?>
                <div id="portfolio-wrap" class="clearfix filterable-portfolio">
                    <div class="portfolio-content">
                        <?php while ( $wpex_port_query->have_posts() ) : $wpex_port_query->the_post(); ?>
                            <?php $wpex_count++; ?>
                            <?php if ( has_post_thumbnail($post->ID) ) { ?>
                                <article class="portfolio-item col-<?php echo $wpex_count; ?> <?php if( $terms ) foreach ( $terms as $term ) { echo $term->slug .' '; }; ?>">
                                    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php echo genesis_get_image( array( size => 'portfolio' ) ); ?>
                                    <div class="portfolio-overlay"><h3><?php the_title(); ?></h3></div><!-- portfolio-overlay --></a>
                                </article>
                            <?php } ?>
                        <?php endwhile; ?>
                    </div><!-- /portfolio-content -->
                </div><!-- /portfolio-wrap -->
            <?php } ?>
            <?php wp_reset_postdata(); ?>
        </div><!-- /entry-content -->
    
    <?php }
    
    genesis();

  • The topic ‘Portfolio template get category’ is closed to new replies.