Before you ask please READ THIS

exclude a portfolio category

edited January 2012 in Airlock Posts: 15
How can I exclude a portfolio category on the main page and on the portfolio site?

Comments

  • AirAir
    Posts: 10,970
    Hi there.

    Is is not an easy task but lets try:

    We will have to edit query for portfolio. For front-page we edit file front-page.php, find lines (around line 103):

    $args = array(
    'posts_per_page' => $per_page,
    'offset' => $offset,
    'post_type' => PORTFOLIO_POST_TYPE,
    'post_status' => 'publish',
    'ignore_sticky_posts' => true,
    // 'orderby' => 'epo_custom'
    );
    and change them to:

    $args = array(
    'posts_per_page' => $per_page,
    'offset' => $offset,
    'post_status' => 'publish',
    'ignore_sticky_posts' => true,
    'post_type' => PORTFOLIO_POST_TYPE,
    'tax_query' => array(
    array(
    'taxonomy' => 'skills',
    'field' => 'slug',
    'terms' => array( 'other','video' ),
    'operator' => 'NOT IN'
    )
    )
    );
    There in 'terms' => array( 'other','video' ), you add slugs of categories you wish to exclude. I added 'other' and 'video'. Slugs of categories of portfolio you can find in Admin->My portfolio->Portfolio Categories in column slug.

    To exclude category in main portfolio page you do the same but in file taxonomy-skills.php in line 26(around).

    ---

    To hide category in list of categories(above your portfolio projects) easiest way would be to hide via CSS. For example we want to hide category with slug 'other' so we add such CSS:

    .portfolio_cat-other{ display: none; } /* hides category */
    .portfolio_cat-other + span{ display: none; } /* hides category separator */
    Hope that helps.
  • Posts: 15
    Thanks a lot. But the CSS solution isn't really useful. If I assign two different categories to a single portfolio item and exclude one, it doesn't show up under "All".
  • AirAir
    Posts: 10,970
    Damn I forgot that same classes are in portolio items. Anyway CSS solution was(in plan) for hiding category from menu. This should be better:

    #portfolioList .portfolio_cat-other{ display: none; } /* hides category */
    #portfolioList .portfolio_cat-other + span{ display: none; } /* hides category separator */
  • edited April 2012 Posts: 0
    The user and all related content has been deleted.
    Post edited by [Deleted User] on
  • AirAir
    Posts: 10,970
    1. Probably yes- give link, so I could find proper rule :-)
    But better edit that file you have created and delete those lines:

    if( $count_terms ):
    echo '';
    if( $apollo13->get_option( 'portfolio_options', 'show_featured' ) == 'yes' && empty( $term_slug ) ){
    $slug = 'featured';
    echo '' . __( 'Featured', TPL_SLUG ) . '';
    echo $separator;
    }
    echo '' . __( 'All', TPL_SLUG ) . '';
    echo $separator;
    foreach($terms as $term) {
    echo 'slug . ( ($term_slug == $term->slug) ? ' selected' : '' ) . '" href="' . get_term_link($term) . '">' . $term->name . '';
    if( $count_terms != $iter ){
    echo $separator;
    }
    $iter++;
    }
    echo '';
    endif;
    2. This point I don't understand, cause I don't get what you would like to achieve. Some live link with description would tell me more(where should it lead? do you want change name or slug also? somthing like that ;-) )

    Good job btw ;-)

    With regards.


  • The user and all related content has been deleted.
  • edited April 2012 Posts: 0
    The user and all related content has been deleted.
    Post edited by [Deleted User] on
  • AirAir
    Posts: 10,970
    I add tags <pre> my code </pre> or use preformatted text option in visual editor ;-)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!