Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am new to the site and have racking my brain on a Wordpress issue for days. Hope you the intelligent people here can help me figure this out.

I have a page on my website that displays all my portfolios at once. My portfolios can be categorized into different 'sets'. There are particular 'sets' that I would like to not display on this page. The page can be viewed here: http://www.industrygallerydc.com/works/

I believe I have pinpointed the loop that causes the portfolio 'sets' to display:

//prepare data for pagintion
$offset_query = '';
if(!isset($_GET['page']) OR empty($_GET['page']) OR $_GET['page'] == 1)
{
    $current_page = 1;
}
else
{ 
    $current_page = $_GET['page'];
    $offset = (($current_page-1) * $portfolio_items);
}

$args = array(
    'numberposts' => $portfolio_items,
    'order' => $portfolio_sort,
    'orderby' => 'date',
    'post_type' => array('portfolios'),
    'offset' => $offset,
);
if(!empty($term))
{
    $args['portfoliosets'].= $term;
}

$page_photo_arr = get_posts($args);


//Get all portfolio items for paging

$args = array(
    'numberposts' => -1,
    'order' => $portfolio_sort,
    'orderby' => 'date',
    'post_type' => array('portfolios'),
);
if(!empty($term))
{
    $args['portfoliosets'].= $term;
}

$all_photo_arr = get_posts($args);
$total = count($all_photo_arr);

if(isset($page_photo_arr) && !empty($page_photo_arr))
{   
?>

Is there a way I can exclude a 'set' here?

share|improve this question
    
What your "sets" are technically? Native native tags/categories? Terms of custom taxonomy? Something else? –  Rarst Oct 9 '12 at 0:56
add comment

1 Answer

so I am thinking your $arg would be:

$args = array(
    'numberposts' => $portfolio_items,
    'order' => $portfolio_sort,
    'orderby' => 'date',
    'post_type' => array('portfolios'),
    'offset' => $offset,
    'exclude'         => '1,2',
);

And that would exclude post 1 and 2.

But a better option that you should do, is to just create a featured category for your work. And then only display the posts that are in the featured category. That way you wouldn't have to hand type in post ID's everytime you want them excluded in your loop.

share|improve this answer
    
Thank you westondeboer for the quick response. But what I am adding is classified as a portfolio not a post. Does this make a difference? The new portfolios I do add can be classified with a 'set'. For instance say I create a 3 different portfolios for 3 different designers and I then classify them all under a set called 'Lighting'. Is there a way to exclude that set from being shown on the page I linked above? –  DENNIS Oct 8 '12 at 2:34
    
It does not make a difference. And how are you classifying your set called lightning? Is it a custom post taxonomy or just category? –  westondeboer Oct 8 '12 at 18:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.