-
AuthorPosts
-
July 24, 2018 at 8:38 pm #989354
Enfold theme – I want to sort my portfolio items by menu order – how do I add this? I see it as an option in Masonry for home page to display Portfoilio items to sort by Page Order but I don’t see that under Screen Options? Is there a function I can use to get order working as we need these in a specific order. Thanks
July 25, 2018 at 10:29 am #989593Hey calnettech2,
Thank you for using Enfold.
The “page-attribute” feature is not supported by the portfolio post type by default so you have to enable it. Add this filter in the functions.php file.
/* Change portfolio post type settings */ add_filter('avf_portfolio_cpt_args', 'avf_portfolio_cpt_args_mod'); function avf_portfolio_cpt_args_mod($args) { $args['supports'][] = 'page-attributes'; return $args; }
Best regards,
IsmaelJuly 25, 2018 at 4:44 pm #989788Added the function – thanks! but still not sorting as expected. There is a masonry block on the home page that is sorting by page order, ascending, which is not sorting even with the new function and menu order added to portfolio items.
Also I have a widget in the 2nd footer widget area. How do I get that to sort with Page order as well.
July 25, 2018 at 5:28 pm #989824Nevermind about Home page – I got that working! Is there a way to sort the second footer widget portfolio list? THANKS
July 26, 2018 at 7:30 am #990085Hi,
Added the function – thanks! but still not sorting as expected.
Did you adjust the value of the page attributes > “order” field for each portfolio items?
Best regards,
IsmaelJuly 26, 2018 at 3:33 pm #990286Please read the latest post – I figured out the home page. Function didn’t translate exactly right but I fixed it. Now I want to sort the second footer widget portfolio list in the same manner.
July 27, 2018 at 11:55 am #990650Hi,
You can create a custom portfolio with a new query. Add this code in the functions.php file.
add_action('after_setup_theme', function() { class avia_portfoliobox_custom extends avia_newsbox { function __construct() { $this->avia_term = 'portfolio_entries'; $this->avia_post_type = 'portfolio'; $this->avia_new_query = array("order" => 'ASC', "orderby" => 'menu_order', "posts_per_page" => 10, 'post_type' => $this->avia_post_type); $widget_ops = array('classname' => 'newsbox', 'description' => __('A Sidebar widget to display latest portfolio entries in your sidebar', 'avia_framework') ); WP_Widget::__construct( 'portfolioboxnew', THEMENAME.' Latest Portfolio New', $widget_ops ); } } register_widget( 'avia_portfoliobox_custom' ); });
Look for the “Portfolio New” widget. You can set the query in this line.
$this->avia_new_query = array("order" => 'ASC', "orderby" => 'menu_order', "posts_per_page" => 10, 'post_type' => $this->avia_post_type);
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.