-
AuthorPosts
-
October 3, 2018 at 6:51 am #1017365
I create some parent portfolios and child portfolio into these, and in the child portfolios I create many child-child-portfolio. When I show the portfolio parent, all the child-child-portfolio are showed.
I want to show only the child-portfolio, 1st heritage of parent portfolio. Can I do that?
Please help meOctober 4, 2018 at 3:27 pm #1017941Hey ezvisa,
Thank you for using Enfold.
Can we take a peek at the site? We need to see the actual setup of your portfolio items and categories.
Best regards,
IsmaelOctober 4, 2018 at 4:13 pm #1017956I can’t show you. But I can explain more clearly then:
– My first Portfolio belong to Portfolio Category 1
– My second belong to Category 2 – Child of Portfolio Category 1.
When I show all the Portfolio Grid from Portfolio Category 1, all the portfolio are showed, include the second. I Dont want that, I want only the portfolio directly belong to Portfolio Category 1 are showed.
That my problem. Please help meOctober 8, 2018 at 12:50 am #1018732Hi,
Thanks for the update.
You can use this filter in the functions.php file to exclude the sub categories.
function array_unshift_assoc(&$arr, $key, $val) { $arr = array_reverse($arr, true); $arr[$key] = $val; $arr = array_reverse($arr, true); return $arr; } // portfolio query add_filter( 'avia_post_grid_query', 'avia_post_grid_query_mod', 1000, 2); function avia_post_grid_query_mod( $query, $params ) { $child_cats = (array) get_term_children( $params['categories'], 'portfolio_entries' ); if ( ! is_admin() ) { // exclude the posts in child categories array_unshift_assoc($query['tax_query'], 'relation', 'AND'); $query['tax_query'][] = array( 'taxonomy' => 'portfolio_entries', 'field' => 'term_id', 'terms' => array(implode(',', $child_cats)), 'operator' => 'NOT IN', ); } return $query; }
Best regards,
IsmaelOctober 9, 2018 at 4:20 am #1019300That’t not work. It still show all of the category 2 portfolio item.
In homepage -> Visa đầu tiên –> “Visa Mỹ: belong to Category 1
Visa du lich My va Visa Cong tac My belong to Category 2 and they are showed when I choose Category 1October 9, 2018 at 4:51 am #1019305 -
AuthorPosts
- You must be logged in to reply to this topic.