Tagged: categories, Portfolios
-
AuthorPosts
-
February 19, 2015 at 2:04 pm #398892
Since there aren’t more than one portfolio types in the Enfold theme and I haven’t seen a solution to what I would like to see, I am posting the query here hoping to have a solution.
I apologize for a long post.
I am building a site where I would like to use portfolios for two different purposes: photography and projects. Since there’s only one portfolio type, I am using categories to separate the two main areas: photos and projects. So far that’s not a problem.
The difficulty arises when choosing to display the categories in the portfolio grid or the masonry grid. You have to select all the categories and/or subcategories related to either the projects or photos. There could be several of each and it’s not practical. Obviously this is also used to filter the portfolio items.
It would be ideal, as a solution I believe, to use just the top category for filtering the portfolio and all the related subcategories would be included automatically.
For example: under the photos category, there could be countries, sports, panoramas, etc. as subcategories. See below:
photos
—countries
—sports
—panoramas
projects
—software
—hardware
—development
—enterpriseThere could be other categories. So if the filtering takes places at the subcategory level, this would be the solution for multiple portfolios. You would simply choose the top level category in the portfolio grid as well as in the short code. It makes it a lot easier to work with portfolios and filters. The top level could easily be added in a menu so you could achieve distinct separation.
Thank you.
Regards,
February 20, 2015 at 2:05 am #399384Hi!
The best solution in this case would be to create new Custom Post Types, you can do it via code or using a handy plugin like Types (you’d also need to create custom Taxonomies for each Post Type).
Once you’ve set-up the new Post Types, add the following lines to your theme / child theme functions.php:
add_theme_support('add_avia_builder_post_type_option'); add_theme_support('avia_template_builder_custom_post_type_grid');
Now when you drag a Portfolio element you’ll be able to select the new Post Types / Taxonomies.
Best regards,
JosueFebruary 22, 2015 at 7:00 am #400182Hi Josue,
OK. I thought my solution was more practical and flexible (perhaps for the future). Anyway, I’ve got it all working thanks to you and the forum. I was wondering about two items, below:
1. How to display the filter for the new CPT (like the one for portfolio already available), and
2. How to get “Additional Portfolio Settings” section to appear for the new CPT?Thank you very much.
Regards,
February 22, 2015 at 10:28 am #400191Hi!
1. Filter options should be available in the Portfolio element displaying this CPT (make sure to set-up the taxonomies).
2. Add this to theme / child theme functions.php:add_filter('avf_builder_boxes','enable_boxes_on_posts'); function enable_boxes_on_posts($boxes) { $boxes[] = array( 'title' =>__('Avia Layout Builder','avia_framework' ), 'id'=>'avia_builder', 'page'=>array('portfolio', 'page', 'post','_CPT_SLUG_HERE_'), 'context'=>'normal', 'expandable'=>true ); $boxes[] = array( 'title' =>__('Layout','avia_framework' ), 'id'=>'layout', 'page'=>array('portfolio', 'page', 'post', '_CPT_SLUG_HERE_'), 'context'=>'side', 'priority'=>'low'); $boxes[] = array( 'title' =>__('Additional Portfolio Settings','avia_framework' ), 'id'=>'preview', 'page'=>array('portfolio', 'page', 'post', '_CPT_SLUG_HERE_'), 'context'=>'normal', 'priority'=>'high' ); return $boxes; }
Regards,
JosueFebruary 23, 2015 at 7:05 am #400400Hi Josue,
Wonderful! All is working well now. Thanks a lot.
If you don’t mind, I’d like to document the entire process for creating a CPT for portfolio purposes and send it across as others might also benefit. The information is scattered here in the support site.
Regards,
February 23, 2015 at 8:41 am #400433You are welcome. Sure, feel free to post the whole process here.
Cheers!
JosueFebruary 28, 2015 at 12:14 am #403756Hi Josue,
Just a follow up to the solution provided. I was checking posts and noticed that “Additional Portfolio Settings” are showing within it. It happened as a result of the code.
After having added the CPT, I wanted the “Additional Portfolio Settings” to be available only for the CPT within the “portfolio” context, as this setting is available for portfolio types. Is it possible to to remove this setting for posts and other pages that are not portfolio types?
Thanks.
February 28, 2015 at 7:15 pm #403879Hi!
Yes, just remove ‘posts’ from ‘page’=>array(…) in the three boxes:
add_filter('avf_builder_boxes','enable_boxes_on_posts'); function enable_boxes_on_posts($boxes) { $boxes[] = array( 'title' =>__('Avia Layout Builder','avia_framework' ), 'id'=>'avia_builder', 'page'=>array('portfolio', 'page', 'post','_CPT_SLUG_HERE_'), 'context'=>'normal', 'expandable'=>true ); $boxes[] = array( 'title' =>__('Layout','avia_framework' ), 'id'=>'layout', 'page'=>array('portfolio', 'page', 'post', '_CPT_SLUG_HERE_'), 'context'=>'side', 'priority'=>'low'); $boxes[] = array( 'title' =>__('Additional Portfolio Settings','avia_framework' ), 'id'=>'preview', 'page'=>array('portfolio', 'page', 'post', '_CPT_SLUG_HERE_'), 'context'=>'normal', 'priority'=>'high' ); return $boxes; }
Cheers!
Josue -
AuthorPosts
- You must be logged in to reply to this topic.